typography fixes

This commit is contained in:
Tyrel Souza 2022-11-03 01:01:50 -04:00
parent b58bddd22b
commit e65c99017f
9 changed files with 130 additions and 92 deletions

View File

@ -9,17 +9,24 @@ Custom Django URLField
For work I had to write a custom url model field. This model field when setting up accepts a default protocol, and a list of other protocols.
| When checking the protocol, the url is split by “://”. If the split has one or two parts, then the url is validly formed.
| In the event of a single element split, there is no protocol specified. When there is no protocol, the url is prepended with the default protocol specified. If there is a protocol, it is checked to make sure it exists in a union of the default protocol and other protocols. If it is not, a ValidationError is raised letting the user know that the protocol is not accepted.
When checking the protocol, the url is split by “://”. If the split has one or two parts, then the url is validly formed.
In the event of a single element split, there is no protocol specified. When there is no protocol, the url is prepended with the default protocol specified. If there is a protocol, it is checked to make sure it exists in a union of the default protocol and other protocols. If it is not, a ValidationError is raised letting the user know that the protocol is not accepted.
This can all be found at On my github [deadlink].
| I have a couple ways I could have done this better and probably will. Improvements would be just one parameter called parameters in which it is checked if there is at least one element. Passing this, when there is no protocol specified, the first element is the default one.
| This would be a little cleaner.
I have a couple ways I could have done this better and probably will. Improvements would be just one parameter called parameters in which it is checked if there is at least one element. Passing this, when there is no protocol specified, the first element is the default one.
| this example would allow for http, https, ssh, spdy and mailto, anything else would error out.
| ``facebook_page = URLField(default_protocol="http",``
| ``protocols=["https","ssh","spdy","mailto"])``
This would be a little cleaner.
| The way I could improve this would be
| ``facebook_page = URLField(protocols=["https","https","ssh","spdy","mailto"])``
this example would allow for http, https, ssh, spdy and mailto, anything else would error out.
.. code:: python
facebook_page = URLField(default_protocol="http", protocols=["https","ssh","spdy","mailto"])
The way I could improve this would be
.. code:: python
facebook_page = URLField(protocols=["https","https","ssh","spdy","mailto"])

View File

@ -7,36 +7,47 @@ You can un-expire a GPG key.
:slug: you-can-un-expire-a-gpg-key
:status: published
Today we had a problem at work on a system. Without getting into too much detail as to give away secrets behind the verbal NDA I am behind, I will just say that it had to do with a GPG public key of mine that was expired on a dev machine, accidentally propagating during install to a production machine.
Today we had a problem at work on a system.
Without getting into too much detail as to give away secrets behind the verbal NDA I am behind, I will just say that it had to do with a GPG public key of mine that was expired on a dev machine, accidentally propagating during install to a production machine.
This key had a sub key as well, so figuring out this was tricky.
To start, you can list your gpg keys like so
To start, you can list your gpg keys like so:
``gpg --list-keys``
.. code:: console
| This will list keys such as
| ``pub 4096R/01A53981 2011-11-09 [expires: 2016-11-07]``
| ``uid         Tyrel Anthony Souza (Five year key for email.)``
| ``sub 4096R/C482F56D 2011-11-09 [expires: 2016-11-07]``
$ gpg --list-keys
| To make this not expire, (same steps to change expiration date to another time), you must first edit the key
| ``gpg --edit-key 01A53981``
| You will then see a gpg prompt
``gpg>``
This will list keys such as
| Type “expire” in and you will be prompted for how long to change it to
| ``Changing expiration time for the primary key.``
| ``Please specify how long the key should be valid.``
| ``        0 = key does not expire``
| ``      <n> = key expires in n days``
| ``     <n>w = key expires in n weeks``
| ``     <n>m = key expires in n months``
| ``     <n>y = key expires in n years``
.. code:: console
| You are then done setting the expiration on the primary key, if you have sub key, doing this is as easy as typing
| ``key 1``
| and repeating the expiration step.
pub 4096R/01A53981 2011-11-09 [expires: 2016-11-07]
uid         Tyrel Anthony Souza (Five year key for email.)
sub 4096R/C482F56D 2011-11-09 [expires: 2016-11-07]
To make this not expire, (same steps to change expiration date to another time), you must first edit the key
.. code:: console
$ gpg --edit-key 01A53981
You will then see a gpg prompt ``gpg>``
Type “expire” in and you will be prompted for how long to change it to
.. code:: console
Changing expiration time for the primary key.
Please specify how long the key should be valid.
        0 = key does not expire
      <n> = key expires in n days
     <n>w = key expires in n weeks
     <n>m = key expires in n months
     <n>y = key expires in n years
You are then done setting the expiration on the primary key, if you have sub key, doing this is as easy as typing ``key 1`` and repeating the expiration step.
To finish and wrap things up, type ``save`` and you are done.

View File

@ -9,18 +9,19 @@ Some BASH tips
I realize I havent updated in a while. I havent had much free time recently as Ive been working on a project for my father in C# after work hours. This is a great change from only working in Python and JavaScript recently. Im making a program that will analyze test results from a plasma torch for a company called HyperTherm. My father built the physical machine, but the employees want something that they can better see the results of a passed torch unit, or a failed torch unit. This program has a bar code scanner that scans the tool used in the test and matches it up to the lot of torch parts. Another added feature is the ability to print a white label that says “UNIT PASSED” or a giant red label that says the unit failed and which of the 8 tests failed were. I had to learn how to use delegates, as my serial event listener is on a separate thread and I cant update labels, or parts of the User Interface without them.  Still working on it, hopefully will wrap it up by Saint Patricks day.
I recently found a cool command in BASH that I hadnt previously known.  C-o will execute the current line, and then bring the following line up from BASH history. If you have a set of commands you want to execute again, rather than having to press up 20 times, hit enter, press up 19 times, hit enter, and so on… You can just hit up 20 times. Press C-o as many times as you need to.
| For example
I recently found a cool command in BASH that I hadnt previously known.  ``C-o`` will execute the current line, and then bring the following line up from BASH history. If you have a set of commands you want to execute again, rather than having to press up 20 times, hit enter, press up 19 times, hit enter, and so on… You can just hit up 20 times. Press C-o as many times as you need to.
For example:
.. code:: console
tacidsky@ip-234:~$ touch a
tacidsky@ip-234:~$ touch b
tacidsky@ip-234:~$ touch c
$ touch a
$ touch b
$ touch c
# [up] [up] [up]
tacidsky@ip-234:~$ touch a [C-o]
tacidsky@ip-234:~$ touch b [C-o]
tacidsky@ip-234:~$ touch c [C-o]
$ touch a [C-o]
$ touch b [C-o]
$ touch c [C-o]
As you can see there, all I had to do was go back to the \`touch a\` line, and hit control-o three times and it touched the files again!
As you can see there, all I had to do was go back to the ``$ touch a`` line, and hit control-o three times and it touched the files again!

View File

@ -23,7 +23,9 @@ I was planning on hanging out with him next weekend, as he was busy with somethi
Harry Delmolino, we may not have been as close as we could have been, but you definitely made a difference in my life for the better and I never got to thank you for this.
| Edit:
| I went to the Calling Hours today and I was only there maybe a half hour, but there were so many people there. Its amazing that a man so young has touched so many lives of so many people, and had accomplished so much. People might say “Oh we was just a kid, he was only 18″ but if they looked at the accomplishments of this young man, they would realize how grown up he was.
Edit:
-----
I went to the Calling Hours today and I was only there maybe a half hour, but there were so many people there. Its amazing that a man so young has touched so many lives of so many people, and had accomplished so much. People might say “Oh we was just a kid, he was only 18″ but if they looked at the accomplishments of this young man, they would realize how grown up he was.
I think his mother and father might eventually delete his Facebook, so I went back and took a screenshot of one of our last conversations so I can remember. Everything he said usually warranted a laugh.

View File

@ -8,7 +8,6 @@ Getting started in Python Part 1
:status: published
I have a friend who is interested in becoming a Python developer. He has some Python experience with CodeAcademy, but he of course wants to take this a step further and develop on his own computer. I figure Id give him a few pointers, and I know this has been rehashed a million times, but what the hell, why not blog on it again.
There are a few important things to learn besides the actual language itself. The first I am going to discuss is has to deal with installing packages, then followed up closely with Pythons path trickery. Finally Im going to wrap up by discussing some software related to development, that could be used for any language, but I use daily in my work as a Python Software Engineer. Lets get started.
PIP
@ -16,21 +15,25 @@ PIP
Python is a wonderful language, but how useful would it be if you had to rewrite everything by hand? Not useful at all. Thats why the lovely pip developers were born. `PIP <https://pypi.python.org/pypi/pip>`__ (executable pip) is a package manager written for Python. Its very simple to use, and in my opinion is way better than easy_install. To use pip you need to know at a minimum three commands.
| *pip install*
| This command does exactly what it says on the box. It queries PyPI (Python Package Index) and downloads the latest version of the package on the server. It then installs it to your site-packages.
``pip install``
| *pip uninstall*
| This deletes all files associated with the package supplied. 100% simple.
This command does exactly what it says on the box. It queries PyPI (Python Package Index) and downloads the latest version of the package on the server. It then installs it to your site-packages.
| *pip freeze*
| This shows what packages are installed on your system and what versions. If you supply local it will show what packages are installed in your current environment.
| These three commands will get you started with package management, there are more commands you can find by looking through the help documents.
``pip uninstall``
This deletes all files associated with the package supplied. 100% simple.
``pip freeze``
This shows what packages are installed on your system and what versions. If you supply local it will show what packages are installed in your current environment.
These three commands will get you started with package management, there are more commands you can find by looking through the help documents.
Virtualenv
----------
| If you notice I mentioned a current environment in my previous *pip freeze* explanation, here is why. Python has a default place that it looks when you reference a package. This is generally in something like **/usr/lib/python2.7/site-packages/** or **C:\\Python27\\lib\\**. There is a set of scripts called *virtualenv* that creates an environment where you run it with a complete copy of your Python executable, and a blank (unless you copy them over) site-packages directory. You can then install any packages there activate the virtual environment. When activated you use those specific versions, no matter the version of what is installed on your system.
| Lets show an example of the first time use of *virtualenv*:
If you notice I mentioned a current environment in my previous ``pip freeze`` explanation, here is why. Python has a default place that it looks when you reference a package. This is generally in something like ``/usr/lib/python2.7/site-packages/`` or ``C:\Python27\lib``. There is a set of scripts called ``virtualenv`` that creates an environment where you run it with a complete copy of your Python executable, and a blank (unless you copy them over) site-packages directory. You can then install any packages there activate the virtual environment. When activated you use those specific versions, no matter the version of what is installed on your system.
Lets show an example of the first time use of ``virtualenv``:
.. code:: console
@ -39,12 +42,14 @@ Virtualenv
$ source myenv/bin/activate # Activate the virtual environment
(myenv)$ python -c "import MYPACKAGE; print MYPACKAGE"
Notice how it says your package is not in **/usr/lib/python2.7/site-packages/** ? Thats because youre using *virtualenv* to tell your copied python to use that library instead. There are many reasons you would want to use a virtual environment. The most frequent reason is to preserve version numbers of installed packages between a production and a development environment. Another reason virtualenv is useful if you do not have the power to install packages on your system, you can create a virtual environment and install them there.
Notice how it says your package is not in ``/usr/lib/python2.7/site-packages/`` ? Thats because youre using ``virtualenv`` to tell your copied python to use that library instead. There are many reasons you would want to use a virtual environment. The most frequent reason is to preserve version numbers of installed packages between a production and a development environment. Another reason virtualenv is useful if you do not have the power to install packages on your system, you can create a virtual environment and install them there.
Virtualenvwrapper
-----------------
After you create a virtual environment, you just run *source bin/activate*\ and it will activate the virtual environment. This can get tedious knowing exactly where your virtual environments are all the time, so some developers wrote some awesome scripts to fix that problem. This is called *virtualenvwrapper *\ and once you use it once, you will always want to use it more. What it does is that it has you create a hidden directory in your home directory, set that to an environment variable and references that directory as the basis for your virtual environments. The installation of this is pretty easy, you can *pip install virtualenvwrapper* if you want, or download the package and compile by hand. Once installed correctly, you can run the command *mkvirtualenv envname* to create a virtual environment. You can then run *workon envname* from anywhere, and it will activate that environment. For example, you could be at **/var/www/vhosts/www.mysite.com/django/** and run *workon envname* and it would activate the environment from there. This isnt a required package (none of them are really…) as I went a couple years without using *virtualenvwrapper, *\ but it is very useful and now I use it every day. Some tips I use with my setup of *virtualenvwrapper* is that I use the postactivate scripts to automatically try to change into the proper project directory of my environment. This also means I usually name my *virtualenv * after my project name for easy memory. It makes no sense to have a project called “cash_register” but the *virtualenv* be called “fez”. This is how I change to the right project after activating my *virtualenv.* This goes in **$WORKON_HOME/postactivate**
After you create a virtual environment, you just run ``source bin/activate`` and it will activate the virtual environment. This can get tedious knowing exactly where your virtual environments are all the time, so some developers wrote some awesome scripts to fix that problem. This is called ``virtualenvwrapper`` and once you use it once, you will always want to use it more. What it does is that it has you create a hidden directory in your home directory, set that to an environment variable and references that directory as the basis for your virtual environments. The installation of this is pretty easy, you can ``pip install virtualenvwrapper`` if you want, or download the package and compile by hand.
Once installed correctly, you can run the command ``mkvirtualenv envname`` to create a virtual environment. You can then run ``workon envname`` from anywhere, and it will activate that environment. For example, you could be at ``/var/www/vhosts/www.mysite.com/django/`` and run ``workon envname`` and it would activate the environment from there. This isnt a required package (none of them are really…) as I went a couple years without using ``virtualenvwrapper``, but it is very useful and now I use it every day. Some tips I use with my setup of ``virtualenvwrapper`` is that I use the postactivate scripts to automatically try to change into the proper project directory of my environment. This also means I usually name my ``virtualenv`` after my project name for easy memory. It makes no sense to have a project called “cash_register” but the ``virtualenv`` be called “fez”. This is how I change to the right project after activating my ``virtualenv``. This goes in ``$WORKON_HOME/postactivate``
.. code:: bash

View File

@ -17,26 +17,27 @@ Here are a couple of the commands I use daily:
Movement
~~~~~~~~
- To move to the beginning of a line, you press **C-a**
- To move to the end of a line you press **C-e**
- To move to the beginning of a line, you press ``C-a``
- To move to the end of a line you press ``C-e``
Killing and Yanking
~~~~~~~~~~~~~~~~~~~
- To cut the rest of the line from where your cursor is, to the end, you press **C-k**
- To delete one word you press **C-w**
- To paste either of the two previous back you can press **C-y**
- To cut the rest of the line from where your cursor is, to the end, you press ``C-k``
- To delete one word you press ``C-w``
- To paste either of the two previous back you can press ``C-y``
Miscellaneous
~~~~~~~~~~~~~
- To clear the screen and get to a fresh start, you can press **C-l**
- To end your session you can send a **C-d** (This will send an end of file character)
- To search for a command you typed recently, press **C-r** and start typing, it will search backwards. **C-r** again will search for an earlier match.
- The inverse of **C-r ** is **C-s**, they function the same.
- To clear the screen and get to a fresh start, you can press ``C-l``
- To end your session you can send a ``C-d`` (This will send an end of file character)
- To search for a command you typed recently, press ``C-r`` and start typing, it will search backwards. ``C-r`` again will search for an earlier match.
- The inverse of ``C-r`` is ``C-s``, they function the same.
- To open your ``$EDITOR`` to edit the current shell command you wish to write, press ``C-x C-e``
Finally, dont forget about **C-c**. While not specifically Readline, its very useful because it sends the SIGINT signal to the program, which if just on the command line, will not execute the line you have type, and give you a new line with nothing on it. A nice clean start.
Finally, dont forget about ``C-c``. While not specifically Readline, its very useful because it sends the SIGINT signal to the program, which if just on the command line, will not execute the line you have type, and give you a new line with nothing on it. A nice clean start.
To find out a lot more, read the documentation at `the Readline Commands Docs <http://www.gnu.org/software/bash/manual/html_node/Bindable-Readline-Commands.html>`__ I even learned some things while writing this up, apparently pressing **C-x $** will list off all the possible usernames. Good to know, and good to always keep learning.
To find out a lot more, read the documentation at `the Readline Commands Docs <http://www.gnu.org/software/bash/manual/html_node/Bindable-Readline-Commands.html>`__ I even learned some things while writing this up, apparently pressing ``C-x $`` will list off all the possible usernames. Good to know, and good to always keep learning.

View File

@ -9,9 +9,9 @@ Too many open files
When I worked at Propel Marketing, we used to outsource static websites to a third party vendor, and then host them on our server. It was our job as developers to pull down the finished website zip file from the vendor, check it to make sure they used the proper domain name, (they didnt a lot of the time,) and make sure it actually looks nice. If these few criteria were met, we could launch the site.
Part of this process was SCPing the directory to our sites server. The sites server was where we had Apache running with every custom static site as a vhost. We would put the website in /var/www/vhosts/domain.name.here/ and then create the proper files in sites-available and sites-enabled (more on this in another entry). After that the next step was to run a checkconfig and restart Apache.
Part of this process was SCPing the directory to our sites server. The sites server was where we had Apache running with every custom static site as a vhost. We would put the website in ``/var/www/vhosts/domain.name.here/`` and then create the proper files in sites-available and sites-enabled (more on this in another entry). After that the next step was to run a checkconfig and restart Apache.
Heres where it all went wrong one day. If I can recall correctly, my boss was on vacation so he had me doing a bit of extra work and launching a few more sites than I usually do. Not only that, but we also had a deadline of the end of the month which was either the next day, or the day after. I figure Ill just setup all mine for two days, and then have some extra time the next day for other things to work on. So I started launching my sites. After each one, I would add the domain it was supposed to be at into my /etc/hosts file and make sure it worked.
Heres where it all went wrong one day. If I can recall correctly, my boss was on vacation so he had me doing a bit of extra work and launching a few more sites than I usually do. Not only that, but we also had a deadline of the end of the month which was either the next day, or the day after. I figure Ill just setup all mine for two days, and then have some extra time the next day for other things to work on. So I started launching my sites. After each one, I would add the domain it was supposed to be at into my ``/etc/hosts`` file and make sure it worked.
I was probably half way done with my sites, and suddenly I ran into one that didnt work. I checked another one to see if maybe it was just my network being stupid and not liking my hosts file, but no, that wasnt the problem. Suddenly, EVERY SITE stopped working on this server. Panicking, I delete the symlink in sites-enabled and restart Apache. Everything works again. I then proceed to put that site aside, maybe something in the php files breaks the server, who knows, but I have other sites I can launch.

View File

@ -25,7 +25,6 @@ EXPERIENCE
EverQuote — Boston, MA — Senior Software Engineer >>> January 2022 -
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Ported a Python2.7 monolith to Python3 microservices.
* Automated a daily task for two analysts to be able to be run in only a few moments which saves 18 hours per week of analyst time.
* Built a UI for manipulating database settings to aid in automating work for analysts.
@ -37,12 +36,12 @@ EverQuote — Boston, MA — Senior Software Engineer >>> January 2022 -
Tidelift — Boston, MA — Software Engineer III >>> April 2018 - December 2021
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Command Line Interface https://tidelift.com/cli
Command Line Interface https://tidelift.com/cli
* Developed binary CI/CD tool in Go to analyze software dependencies for security/licensing problems
* Added ability to create users and manage repositories from the command line
* Expanded personal project into company product
* Developed binary CI/CD tool in Go to analyze software dependencies for security/licensing problems
* Added ability to create users and manage repositories from the command line
* Expanded personal project into company product
* Tidelift core redesign and pivot
* Pivoted from solely a vulnerability scanner to supporting a catalog of open source dependencies
* Part of small team developing Tidelift 2.0/3.0
@ -50,8 +49,11 @@ Command Line Interface https://tidelift.com/cli
* Expanded open source code under https://libraries.io to support more languages.
* Added new languages manifests support
* Programmed in multiple projects with code all available as open source on github
* `Bibliothecary <https://github.com/librariesio/bibliothecary>`_: Added ability to detect dependencies in manifests for Poetry, pip-compile, pipfile,
* Conda
* `Conda Parser <https://github.com/librariesio/conda-parser>`_: Developed ingestor of Conda environment files, parsing environment.yml files
* `Conda API <https://github.com/librariesio/conda-api>`_: Programmed web scraping of Anaconda to detect new packages, and REST API endpoints for packages
@ -61,7 +63,9 @@ Addgene — Cambridge, MA — Software Engineer >>> March 2015 - March 2018
* Wrote Django REST Framework API server behind a token-authenticated NGINX server
* Rewrote file storage backend to keep on Amazon S3 instead of local in-house file system
* Released my own custom Django module as a result
* Trained non-developers in Python
* Helped start and expand a “non-developer developer” club
@ -69,7 +73,9 @@ Akamai — Cambridge, MA — Sr. Software Engineer >>> July 2014 - March 2015
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Wrote an API with Python/Flask that the front end could communicate with
* Checked if email was a valid user in Salesforce, then sent the user an email from a template
* Rewrote the backend for an internal dashboard to load data in 0.1 second, down from 10 seconds
Propel Marketing — Quincy, MA — Software Engineer >>> September 2012 - July 2014
@ -87,23 +93,19 @@ Appropriate Solutions Inc — Peterborough, NH — Software Developer >>> July
SKILLS
------
Python, Go, Django, Flask, Linux, Docker, Git, Mercurial Postgres, MySQL, MariaDB,
Amazon AWS (S3 mostly) Google Cloud Storage, REST APIs Kafka, Redis, memcached, Sidekiq,
RabbitMQ, Eclipse Mosquitto
* Python, Go, Django, Flask, Linux, Docker, Git, Mercurial Postgres, MySQL, MariaDB, Amazon AWS (S3 mostly) Google Cloud Storage, REST APIs Kafka, Redis, memcached, Sidekiq, RabbitMQ, Eclipse Mosquitto
EDUCATION
---------
Keene State College - B.S. Applied Computer Science, Minor in Mathematics, Deans List
* Keene State College - B.S. Applied Computer Science, Minor in Mathematics, Deans List
PERSONAL PROJECTS
-----------------
`Django DBFileStorage <https://gitlab.com/Tyrel/django-dbfilestorage>`_
Goal: to continue running CI tests on a remote storage when working on moving file storage to S3 without
incurring additional AWS charges.
* `Django DBFileStorage <https://gitlab.com/Tyrel/django-dbfilestorage>`_ Goal: to continue running CI tests on a remote storage when working on moving file storage to S3 without incurring additional AWS charges.
VOLUNTEERING
------------
Boston Athletic Association Amateur Radio Operator - 2019 Boston Marathon
* Boston Athletic Association Amateur Radio Operator - 2019 Boston Marathon

View File

@ -16,7 +16,8 @@ p {
padding-left: 0.75rem;
line-height: 1.2rem;
font-size: 14px;
text-align: left
text-align: left;
padding-bottom: 0.75rem;
}
.literal {
@ -28,7 +29,7 @@ p {
font:12px Monaco,Consolas,"Andale Mono","DejaVu Sans Mono",monospace
}
.literal-block {
.literal-block, pre {
width: 95%;
border-radius: 5px;
-moz-border-radius: 5px;
@ -114,3 +115,11 @@ h3.entry-title{
a:link.permalink { text-decoration: none; }
ul.simple {
list-style: square inside none;
padding-left:1rem;
}
ul ul {
list-style-type: circle;
padding-left: 2rem;
}