Skip to content

Instantly share code, notes, and snippets.


blank slate setup

install dokku, visit in browser to complete install genrate ssh key for github actions/dokku server using ssh-keygen, and copy the private key to the github repo secrets.

Create front-end app

dokku apps:create front-end

chrisjsimpson / main.go
Created Jul 25, 2021
Go postgres connect to database
View main.go
import "fmt"
import "os"
import "log"
import (
_ ""
func main() {
chrisjsimpson /
Created Apr 1, 2019 — forked from jeteon/
Convert coordinates in DMS notation to decimal in Python.
# coding=utf8
Converting Degrees, Minutes, Seconds formatted coordinate strings to decimal.
DEC = (DEG + (MIN * 1/60) + (SEC * 1/60 * 1/60))
Assumes S/W are negative.
import subprocess
from random import randrange
from flask import Flask
def create_app():
app = Flask(__name__)
def create_container():
container_id = randrange(1000,9000)
chrisjsimpson /
Created Nov 24, 2020
Stripe connect create subscription and trigger trial, finalise invoice and confirm payment
# Create a customer
CUSTOMER_ID=`stripe customers create --stripe-account=$CONNECT_ACCOUNT_ID | jq -r .id`
# Create a payment method
PAYMENT_METHOD=`stripe payment_methods create --stripe-account=$CONNECT_ACCOUNT_ID \
--type=card \
-d "card[number]"=4242424242424242 \
-d "card[exp_month]"=11 \
-d "card[exp_year]"=2021 \
from pprint import pprint
import random
#Order of importance
suit = ['ace', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'jack', 'queen', 'king']
def build_pack():
''' Builds and returns a pack of sorted cards'''
cards = [] # Empty list of cards to be built
# Build hearts
chrisjsimpson /
Created Mar 25, 2019
OBP generate direct login token
You need to install pythin requests library for this to work
e.g. pip install requests
You also need to use python3
import requests
consumer_key = input("Consumer Key --> ")
username = input("Username --> ")
password = input("Password --> ")
View gist:189f4f2df8df122d26001080e06a9ca4
import urllib2
from bs4 import BeautifulSoup
import json
import re
#fp = open('soup.txt')
#doc =
response = urllib2.urlopen('')
doc =
chrisjsimpson / mosre_hastle_than_its_worth.php
Created Aug 27, 2012
php cli search via command line
View mosre_hastle_than_its_worth.php
/* Terminal sript for fast searching of the page
* Requires: php5, curl, php-cli, w3m (use sudo apt-get install programName)
* For defaults just leave questions blank & press enter.
* Notes for improvement:
* > No pagination support (only shows page one of results)
* > Writes search result to a file- this is messy, must be better way
View gist:40b369e76d57a9bfd9379ce50bdf596c
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from import Select
code = input("What's the code?")
fp = webdriver.FirefoxProfile()