Developer Journal: 28 April 2020

Posted on Tue 28 April 2020 in dev-journal • Tagged with developer journal

Yesterday I wrote a very simple test for a delete route:

@patch('app.models.launch_task')
def test_delete_removes_worker_from_db(self, mock_launch):
    mock_launch.return_value = ""
    login_user(self.client, email=self.user.email, password='password')

    self.client.delete(self.base_url)
    workers = SiteWorker.query.all()
    self.assertEqual(len(workers), 0)

To allow that test to pass …


Continue reading

Developer Journal: 27 April 2020

Posted on Mon 27 April 2020 in dev-journal • Tagged with developer journal

Working on creating a release for Conveyor that will implement the rq-gevent-worker and additional bug fixes.

Updated the rq-gevent-worker setup.py and added same documentation to the readme.

The original owner seems to have abandoned this project but I wanted to make sure the author stayed in the package so …


Continue reading

Developer Journal: 25 April 2020

Posted on Sat 25 April 2020 in dev-journal • Tagged with developer journal

Fixing a bug that was introduced when changing the create server view to no longer include a radio field for the server provider. The logic was changed to use request arguments to generate the correct form but the view was not updated to do the same as the form field …


Continue reading

Developer Journal: 24 April 2020

Posted on Fri 24 April 2020 in dev-journal • Tagged with developer journal

Would would this look like if it were easy?

This is the single most important question I have been asking myself lately. It motivates me to simplify the process. Today this question helped me write some additional logic to my screenshot hotkey to simplify the process of adding photos to …


Continue reading

Developer Journal: 23 April 2020

Posted on Thu 23 April 2020 in dev-journal • Tagged with developer journal

Looking into using Facebook Workplace as a place that virtual conference attendees can network with each other. There is a nice writeup at https://www.contentandcode.com/blog/an-introduction-to-facebook-workplace/ that goes over the basic features.

Most of today was spent doing design work. Found a great hotkey for figma which …


Continue reading

Developer Journal: 22 April 2020

Posted on Wed 22 April 2020 in dev-journal • Tagged with developer journal

Creating a new command to save screenshots in my dev journal folder

This meant adding the convert -trim command that I discovered recently into the screenshot command for i3. In addition to that a new command was created that would save the screenshots in a different location.

# .config/i3/config …

Continue reading

Developer Journal: 20 April 2020

Posted on Mon 20 April 2020 in dev-journal • Tagged with developer journal

Updated the Conveyor register page to match the pricing on the marketing page. Whoops.

Based on the work that was accomplished yesterday with just using threads as a background process instead of a full blown worker queue, the question of what would happen if the python app was restarted while …


Continue reading

Developer Journal: 19 April 2020

Posted on Sun 19 April 2020 in dev-journal • Tagged with developer journal

Digging back into a piece of Conveyor that has not been visited for a while. The worker queue for running commands on a conveyor server. Working on making a prototype to test the idea of using threads instead of RQ.

Currently what has been done is refactoring the model to …


Continue reading

Developer Journal: 18 April 2020

Posted on Sat 18 April 2020 in dev-journal • Tagged with developer journal

Using Conveyor.dev to provision a server for an OpenVPN server

Wanted to create a vpn server today. Last time I did this manually and it was a bit of a learning process. While doing this again would certainly be faster, there was a script to completely take care of …


Continue reading

Developer Journal: 17 April 2020

Posted on Fri 17 April 2020 in dev-journal • Tagged with developer journal

While updating my system I ran into the following error:

$ sudo apt update
Ign:1 https://brave-browser-apt-release.s3.brave.com bionic InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu bionic InRelease
Err:3 https://brave-browser-apt-release.s3.brave.com bionic Release
  Certificate verification failed: The certificate is NOT trusted. The …

Continue reading

Developer Journal: 16 April 2020

Posted on Thu 16 April 2020 in dev-journal • Tagged with developer journal

Automating developer journal entry creation

Wrote a script to help make creating developer journals easier to use. It was a simple zsh script but I had to look up a few things.

How do you check if a file already exists?

Found an example here

if test -f "$filename"; then …

Continue reading

Developer Journal: 15 April 2020

Posted on Wed 15 April 2020 in dev-journal • Tagged with developer journal, python, redis

Spent some time today trying to use Redis as a way to store a python dictionary. Given my lack of understanding of Redis, I struggled with how to do this and ended up just making a new key with the new value I wanted to store.

So now while the …


Continue reading

Getting started with Conveyor

Posted on Mon 30 March 2020 in conveyor • Tagged with python, flask, django, deployments

Before you start

Before you get started with Conveyor you will need the following:

  • A domain name
  • A Github account
  • Digital Ocean or Linode account

Create a Conveyor.dev account

To get started you will need to create an account on Conveyor.dev

When you log in for the first …


Continue reading

Resizing an ubuntu linux encrypted virtual machine

Posted on Thu 19 March 2020 in posts • Tagged with linux, vm

Resizing a virtualbox disk only works for VDI/VHD and only for dynamic drives

If you have a fixed size drive you need to first clone the drive with the following command (Do this anyway for a backup): VBoxManage clonehd /path/to/ubuntu-vm.vdi ubuntu-vm-clone.vdi

Resize the cloned disk …


Continue reading

Enforcing login on all Flask blueprint routes

Posted on Wed 26 February 2020 in posts • Tagged with python, flask

I found this tip on the Flask subreddit, such a simple solution to make sure you don't forget to add a @login_rquired to a route. You can enforce user login with Flask-Login by using the @before_request decorator.

@bp.before_request
@login_required
def handle_route_permissions():
    # just used to enforce login required on all …

Continue reading

Github apps: Securing webhooks with Python in Flask

Posted on Wed 15 January 2020 in github apps • Tagged with python, flask, github, conveyor, webdev, webhooks

Once you have your Github webhooks working you will want to add a bit of security to make sure that the requests are actually coming from Github. One way to do this is to verify the signature Github sends matches the digest of the message.

Here is an example of …


Continue reading

Github apps: Receiving webhooks with Flask

Posted on Tue 14 January 2020 in github apps • Tagged with python, flask, github, conveyor, webdev, webhooks

Once you have your Github app created you can start receiving webhooks when events occur.

If you want to test this locally you can use an ngrok.io address to route the request to your local computer. Instructions on how to do that can be found at https://developer.github …


Continue reading

Deleting a single certbot certificate

Posted on Thu 10 October 2019 in github apps • Tagged with webdev, certbot, letsencrypt

# run the following command 
certbot delete --cert-name domain.com

Why would you want to do this? In my case I had created certificates for www.conveyor.dev and conveyor.dev. I decided to use a redirect for traffic to conveyor.dev to www.conveyor.dev, by doing that the certbot …


Continue reading

Github apps: Creating and installing an app with Flask

Posted on Sat 21 September 2019 in github apps • Tagged with python, flask, github, conveyor, webdev, webhooks

Create a Github app to integrate with Github

demo

Using a Github app is the preferred way integrate with Github. By creating a Github app you can give your users more granular control of what you have access to. By transitioning Conveyor.dev to use a Github app the level of …


Continue reading

Create a navigation sidebar with flask

Posted on Wed 28 August 2019 in flask • Tagged with python, flask, sidebar, conveyor, webdev

Sometimes pages grow to a point that the need a little help in order to keep it intuitive for the user. I want to share one way that I have been able to keep pages organized and intuitive to the user by using a sidebar with Flask. No javascript involved …


Continue reading

Conveyor Early Access now open

Posted on Wed 21 August 2019 in conveyor • Tagged with python, conveyor

Conveyor.dev early access

Early access to Conveyor is now available.

Visit conveyor.dev to apply.

Conveyor simplifies deployments and lets you focus on building applications

Automatic server provisioning

Site management and deployment

Create PostgreSQL and MySQL databases

Manage your application workers


Pelican static site on Netlify

Posted on Tue 14 May 2019 in python • Tagged with python, pelican, static, netlify

Setup the project

$ mkdir pelican-netlify-cms && cd $_

# create and activate a virtual environment for your project, for example:
$ python -m venv venv
$ source venv/bin/activate

Create a requirements.txt file. This is important as Netlify will look for this file to determine dependencies. In the file:

pelican …

Continue reading

Create a systemd unit for i3lock on suspend

Posted on Tue 04 December 2018 in linux • Tagged with linux, arch, i3lock, i3, systemd

See Creating a custom lockscreen with i3lock to setup the lockscreen script

Add a service file to run the script when the computer sleeps or suspends

Create a file /etc/systemd/system/[email protected] with the following contents. (Change the username to be your local user account name)

[Unit]
Description …

Continue reading

Creating a custom lockscreen with i3lock

Posted on Tue 09 May 2017 in linux • Tagged with linux, arch, i3lock, i3

Instead of the default i3 lockscreen (which is just a plain white screen), you can show an image as the background. You can create a script to show a blurred image of the content on your screen to get the following effect.

Screenlock

Create the script

The short script below will …


Continue reading

ZFS Scrubbing

Posted on Mon 01 May 2017 in zfs • Tagged with zfs

A simple way to check the data integrity of a ZFS pool is by scrubbing the data. This process goes through all of the data and ensures it can be read.

To start a scrub you can run the command:

$ zpool scrub <pool>

If you would like to stop a …


Continue reading

Creating Multiple SSH Key Settings For Github Accounts

Posted on Wed 29 March 2017 in git • Tagged with git, github, ssh

Create a new ssh key for the second account

$ ssh-keygen -t rsa -b 4096 -f "$HOME/.ssh/masecondgit_rsa

Create an ssh config

Create a file at ~/.ssh/config

# create the first host to use your original key as default
Host github.com
    IdentityFile ~/.ssh/id_rsa
    HostName github.com
    User mikeabrahamsen …

Continue reading

Replacing Tmux with Neovim

Posted on Mon 27 March 2017 in Neovim • Tagged with vim, neovim, tmux

While I have tried to use my window manager i3 for creating workspaces for development workflow, I just have not been able to find a completely comfortable solution. There is something about switching between terminals and vim through i3 that I did not find as convenient as my tmux setup …


Continue reading

Replace WLAN / Wifi Card on Lenevo Ideapad u310

Posted on Thu 16 March 2017 in Laptop • Tagged with fixes

The Lenovo Ideapad u310 has been plagued with terrible wifi issues. There was even a class action settlement for it. Upgrading the WLAN card, while a reasonable solution, is not as easy as opening up the laptop and putting a new card in. Lenovo has locked the computer from using …


Continue reading

Setting up ZFS with Arch root install

Posted on Fri 10 March 2017 in Linux • Tagged with linux, arch, zfs

Configuration overview

The last setup of this machine was an UNRAID install with virtual machines using PCI passthrough. For this setup I am going to run Arch Linux with a root install on ZFS. The root install will allow snapshots of the entire operating system.

Array hardware

  • Boot Drive        - 32 …

Continue reading

Creating Arch Linux iso with ZFS installed with EFI system

Posted on Wed 08 March 2017 in Linux • Tagged with linux, arch, zfs

Adding ZFS to the iso can save you some time when you are experimenting with the setup as you will not have to add the repository and install each time you restart the machine this way.

Download archiso

# switch to root
$ sudo -i or su root

# Install archiso
$ pacman -S …

Continue reading