Skip to content

Instantly share code, notes, and snippets.

View adam-stokes's full-sized avatar
🦧

Adam Stokes adam-stokes

🦧
  • North Carolina
  • 11:05 (UTC -04:00)
View GitHub Profile
@stelcodes
stelcodes / bb-postgresql-backup-restore.edn
Last active July 1, 2022 05:20
Babashka Tasks for PostgreSQL Backups
; run `bb backup` to backup database
; run `bb restore` to restore latest backup
{:min-bb-version "0.4.0",
:tasks {; CONSTANTS
db-name "dev_blog",
backup-dir "backups",
now (str (java.time.LocalDateTime/now)),
; TASKS
create-backup-dir {:depends [backup-dir], :task (babashka.fs/create-dirs backup-dir)},
@tlancon
tlancon / us_states_dict.py
Last active May 13, 2022 08:58
Dictionary of All US States and their Abbreviations
# Inspired by https://gist.github.com/JeffPaine/3083347
# Access full state names using us_states.keys()
# Access all state abbreviations using us_states.values()
us_states = {
'Alabama': 'AL',
'Alaska': 'AK',
'Arizona': 'AZ',
'Arkansas': 'AR',
'California': 'CA',
'Colorado': 'CO',
@kwmonroe
kwmonroe / update-cu-brew.txt
Last active October 2, 2019 22:23
update conjure-up for brew
# update brew
brew update
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
# fork https://github.com/Homebrew/homebrew-core
git fetch --all
git checkout master
git pull
git push <FORK>
@CalvinHartwell
CalvinHartwell / canonical-kubernetes-offline-install.sh
Last active August 1, 2018 16:41
canonical-kubernetes-offline-install.sh
#!/usr/bin/env bash
echo "Installing Missing Packages"
sudo apt update && sudo apt install -y simplestreams apache2 apt-mirror git docker.io python3-pip unzip
sudo pip3 install pyyaml
sudo pip3 install pyaml
sudo snap install kubectl --classic
sudo apt-get install juju -y
echo "Writing Config Files"
@aodag
aodag / person.py
Created July 21, 2018 12:12
typing, attrs and sqlalchemy
from typing import Optional
import attr
from sqlalchemy import (
Table,
MetaData,
Column,
Unicode,
Integer,
create_engine,
ForeignKey,
@adam-stokes
adam-stokes / githubcss.css
Last active August 29, 2019 00:43
userstyle github
#files .file .data pre,
#files .file .line-data,
#files .file .line-number,
code,
pre,
.blob-code,
.blob-code-inner,
#readme div.plain pre {
font-family: 'Ubuntu Mono', monospace !important;
font-variant-ligatures: contextual !important;
@borkdude
borkdude / README.md
Last active June 4, 2022 02:26
CLI app with ClojureScript on Node

First install clojure so the clj command will be available.

brew install clojure

Clone and move core.cljs to the right directory:

git clone https://gist.github.com/a6427534ea76cd4e9222a76eb398b289.git inc
cd inc
@ipmb
ipmb / settings.py
Last active November 24, 2023 20:25
Django logging example
import logging.config
import os
from django.utils.log import DEFAULT_LOGGING
# Disable Django's logging setup
LOGGING_CONFIG = None
LOGLEVEL = os.environ.get('LOGLEVEL', 'info').upper()
logging.config.dictConfig({
@Prodge
Prodge / thread_tools.py
Created July 26, 2017 08:27
Python 'Thread First', 'Thread Last' and 'Thread As' Functions - no dependencies
def thread_first(value, *forms):
'''
Returns the given value threaded through the given collection of forms as the first argument.
A form is a function or a tuple containing a function as its first element and a list of arguments.
The return value of the previously called function will be threaded in as the first argument to the next function.
Use this to flatten nested function calls.
Example:
>>> def add(a, b):