Jinja2 Custom Template Tags

Posted on Tue 23 March 2021 in posts • Tagged with jinja2, flask, flask-meld

Building custom template tags in Jinja2 is not an easy task. That used to be the case, which you will see below.

tl;dr: Give jinja2-simple-tags a try.

Why would you create a custom template tag?

From the docs:

By writing extensions you can add custom tags to Jinja. This …


Continue reading

Configuring uWSGI and NGINX for use with Flask-SocketIO

Posted on Fri 11 December 2020 in posts • Tagged with conveyor, meld, flask-meld

Now that Flask-Meld is working, it's time to start getting things ready for production. I've been wanting to start developing Meld components for Conveyor. Flask-Meld utilizes WebSockets, which Conveyor does not currently support. To make all of the magic happen NGINX and uWSGI configurations will need to be updated to …


Continue reading

Goodbye Gmail.

Posted on Thu 26 November 2020 in posts • Tagged with developer journal

After switching from Gmail to self-hosted email, managing the inbox has become more difficult. Making the switch made me realize something; I miss some of the features from Gmail. On my search for an alternative email client, I have seen RoundCube suggested as a web-based, open-source alternative. I started using …


Continue reading

Electric bike (The Telsa 2.0)

Posted on Tue 02 June 2020 in posts • Tagged with Electric Bike, tesla

Late in 2019 The Tesla 2.0 battery was finally upgraded. The battery life had finally degraded to the point that it was only getting about 8 miles per charge. The old battery was 48V 10AH, the new battery is a 48V 20AH and The Tesla 2.0 now has …


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

ZFS setup notes

Posted on Sun 05 March 2017 in posts

install archiso

# sudo pacman -S archiso
# sudo -i or su root

create dir to hold arch live
# mkdir -p ~/archlive
# cp -r /usr/share/archiso/configs/releng/* ~/archlive

edit pacman.conf to add achzfs vim ~/archlive/pacman.conf

[archzfs]
SigLevel = Optional TrustAll
Server = http://archzfs.com/$repo/x86_64

add archzfs-linux …


Continue reading

Installing and configuring php on arch linux

Posted on Sun 28 August 2016 in posts

Installing and configuring php on arch linux

  • Install php sudo pacman -S php php-fpm php-mcrypt
  • Configure timezone in /etc/php/php.ini with date.timezone = America/Denver
  • Install and configure mariaDB
sudo pacman -S mariadb
sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

# uncomment the following lines from …

Continue reading

Install arch linux on rpi3

Posted on Tue 07 June 2016 in posts

Follow instructions from the following url to install:

https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3

change root password: tp root

install some software:

pacman -S sudo gvim

uncomment the visudo line for wheel

$ sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
$ locale-gen
$ echo LANG=en_US.UTF-8 …

Continue reading

VPN Setup

Posted on Fri 26 February 2016 in posts

Used the following tutorial for generating keys: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-14-04

To set up a new client

go to /etc/openvpn/easy-rsa run command ./build-key clientname to generate keys then just copy the keys and make a config on the client

files necessary for client

client.crt …


Continue reading

Debian static network config for 4 port ethernet adapter

Posted on Sun 14 February 2016 in posts

Network config for camera system

# edit the interfaces file `sudo vim /etc/network/interfaces` and add the
following lines

auto lo
iface lo inet loopback

auto eth1
iface eth1 inet static
    address 192.168.10.1
    netmask 255.255.255.0
    mtu 9000
    # to connect to switch, use the following …

Continue reading

Install cuda 7 on Debian 8 Jesse

Posted on Fri 12 February 2016 in posts

From fresh install

install vim, sudo, htop

$ su root
$ apt-get update
$ apt-get install vim sudo htop

export EDITOR=vim

add recorder as sudo $ visudo recorder ALL=(ALL) NOPASSWD: ALL

install needed libraries for cuda install

apt-get install gcc-4.8 make linux-headers-amd64 gcc build-essential

download cuda runfile Version 7.0 (Important …


Continue reading

Arch install

Posted on Fri 24 April 2015 in posts • Tagged with arch

Had to switch secure boot off of windows mode in the bios

set keyboard layout with # loadkeys dvorak

partition the disk with gdisk gdisk /dev/sda o (create new partition table) n (add new partition) # Needs 2 partitions: EFI (ef00) roughly 500Mb Linux? w (write partition to disk)

make filesystem …


Continue reading

Laptop setup with arch

Posted on Wed 17 September 2014 in posts • Tagged with arch

  • configure internet connection
  • set up partitions
  • create filesystems (ext4 ...)

Mount partitions:

(mount root) mount /dev/sda1 /mnt
(mount home) mount /dev/sdb1 /mnt/home
  • select a mirror from /etc/pacman.d/mirrorlist

Install base and base-develop

 pacstrap -i /mnt base base-devel

Generate fstab

genfstab -U -p /mnt >> /mnt/etc …

Continue reading

Printing in arch linux

Posted on Thu 27 March 2014 in posts • Tagged with arch

install cups, gsfronts hplib

    pacman -S cups gsfonts hplib

    hp-setup -i

when running the hp-setup command it gave an error that no PPD file was found I also had to change the usb port from a front port to a port on the motherboard for whatever reason. I had to …


Continue reading

Installing arch linux on desktop

Posted on Tue 25 March 2014 in posts

created two partitions with gparted. One is a 180GB HDD the other is a 60GB SSD

use dd to create bootable usb drive

Select arch linux x64 install

change keyboard to dvorak

    loadkeys dvorak

mount the devices

    mount /dev/sda1 /mnt
    mkdir /mnt/home
    mount /dev/sdb1 /mnt/home

edit …


Continue reading

Mass delete google voice messages

Posted on Tue 11 March 2014 in posts

Install simplejson

sudo pacman -S python-simplejson

Install py-googlevoice from aur

yaourt -S python-pygooglevoice

Change line 70 of voice.py

in usr/lib/python2.7/site-packages/googlevoice/voice.py galx = re.search(r"name=\"GALX\" type=\"hidden\"\n *value=\"(.+)\"", content).group(1)


Debugging remote dev server

Posted on Thu 06 March 2014 in posts

Allow runserver to accept requests from any address

By default, the runserver command will not accept outside connections.

python manage.py runserver 127.0.0.0:8000

This will only accept connections from 127.0.0.0, if you are connected to a remote server and not using port forwarding …


Continue reading

Using The ADXL335 Accelerometer With Arduino

Posted on Wed 20 October 2010 in posts • Tagged with adxl335, arduino

Setting up the DXL335 triple axis accelerometer is pretty straight forward. First I soldered 6 straight breakaway headers into the ADXL335 in order to easily plug the breakout board directly into the analog pins in the Arduino.

Once soldered I plugged the accelerometer in to the following pins:

Breakout Pin …

Continue reading