Skip to content

Instantly share code, notes, and snippets.

View anniethiessen's full-sized avatar
🌻

Annie Thiessen anniethiessen

🌻
  • Okanagan, BC
  • 04:00 (UTC -08:00)
View GitHub Profile
@anniethiessen
anniethiessen / atob_btoa.js
Last active June 11, 2021 20:26
Manual b64 encoder/decoder
// encode
var s = ''
var c, d, e, f, g, h, i, j, o, b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", k = 0, l = 0, m = "", n = [];
do c = s.charCodeAt(k++), d = s.charCodeAt(k++), e = s.charCodeAt(k++), j = c << 16 | d << 8 | e, f = 63 & j >> 18, g = 63 & j >> 12, h = 63 & j >> 6, i = 63 & j, n[l++] = b.charAt(f) + b.charAt(g) + b.charAt(h) + b.charAt(i); while (k < s.length);
m = n.join(""), o = s.length % 3;
s = (o ? m.slice(0, o - 3) :m) + "===".slice(o || 3);
// decode
var s = ''
var b, c, d, e = {}, f = 0, g = 0, h = "", i = String.fromCharCode, j = s.length;
@anniethiessen
anniethiessen / httpd-vhosts.conf
Created January 21, 2021 21:11
Apache config
# /etc/apache2/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "/usr/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common
WSGIPassAuthorization On
@anniethiessen
anniethiessen / pycurl.sh
Last active June 11, 2021 20:27
Resolve pycurl installation issues
# LINUX
brew install openssl
echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export LDFLAGS="-L/home/linuxbrew/.linuxbrew/opt/[email protected]/lib"
export CPPFLAGS="-I/home/linuxbrew/.linuxbrew/opt/[email protected]/include"
export PKG_CONFIG_PATH="/home/linuxbrew/.linuxbrew/opt/[email protected]/lib/pkgconfig"
pip install --install-option="--with-openssl" --install-option="--openssl-dir=//home/linuxbrew/.linuxbrew/opt/[email protected]" pycurl
# Mac
* * * * * root source /opt/python/run/venv/bin/activate && cd /opt/python/current/app/ && python3 manage.py command_name >> /var/log/cronjobs.log
(0 6 * * *)
@lasley
lasley / helpscout_webhook_verify.py
Last active June 5, 2023 09:03
HelpScout WebHook Verification In Python (2 & 3)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import hmac
from base64 import b64encode
from hashlib import sha1
WEBHOOK_SECRET_KEY = 'your secret key'
def is_from_help_scout(data, signature, encoding='utf8'):
@vratiu
vratiu / .bash_aliases
Last active December 4, 2025 09:50
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@perrygeo
perrygeo / django_model_graph.sh
Created April 13, 2013 21:44
Generate UML diagram of django app models
apt-get install python-pygraphviz
pip install django-extensions
# add 'django_extensions' to INSTALLED_APPS in settings.py
python manage.py graph_models trees -o test.png
@cliffparnitzky
cliffparnitzky / create_github_tag.sh
Last active December 18, 2020 22:10
Simple way to create a tag via git shell and push it to repo
# creat a tag (more infos at: http://git-scm.com/book/de/ch2-12.html)
git tag -a 1.0.0 -m "Version 1.0.0"
git push origin 1.0.0
git tag -a 1.0.0.alpha1 -m "Version 1.0.0 alpha1"
git push origin 1.0.0.alpha1
# delete a tag
git tag -d 1.0.0
git push origin :refs/tags/1.0.0