Skip to content

Instantly share code, notes, and snippets.

View diginc's full-sized avatar
🐳

Adam B Hill diginc

🐳
View GitHub Profile
import requests
import sys
import time
import os
def main():
trigger_url = sys.argv[1]
trigger_resp = requests.get(trigger_url)
# SETUP DOCKER
sudo bash
docker ps
apt-get update
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=arm64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
@diginc
diginc / macros.ahk
Last active November 14, 2020 18:05
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; https://autohotkey.com/docs/KeyList.htm
; left hand mouse config
; Accidently hitting numlock a lot...maybe move 'homerow' from 789' to '456'?
#!/bin/bash
BASE='https://raw.githubusercontent.com/stevemao/diff-so-fancy/master/'
for i in diff-so-fancy diff-highlight; do
wget -O ~/bin/$i ${BASE}${i}
chmod +x ~/bin/$i
done;
git --version && git config --global core.pager "diff-highlight | diff-so-fancy | less --tabs=1,5 -R"
Use git for all steps of the process.
Write a server that knows how handle a TODO list. Preferably test driven. Initially the server can use a very simple in-memory collection of items. If time permits, we can have it backed with a database living in another docker container.
Server:
GET /todos
PUT /todos {"title": "<TITLE>", "message": "<MESSAGE"}. Returns the location in the header
GET /todos/ID Returns single note.
POST /todos/ID {"id": "<ID>", "title": "<TITLE>", "message": "<MESSAGE"}. Updates a note
POST /search {"title": "<TITLE_SEARCH_STRING>", , "message": "<MESSAGE_SEARCH_STRING"}. Returns all the todos with a title or message that matches the search. Maybe the search string could be a regex.
# Postfix stuff based on https://gist.github.com/jbrownsc/4694374:
QUEUEID (?:[A-F0-9]+|NOQUEUE)
EMAILADDRESSPART [a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILADDRESSPART:local}@%{EMAILADDRESSPART:remote}
RELAY (?:%{HOSTNAME:relayhost}(?:\[%{IP:relayip}\](?::[0-9]+(.[0-9]+)?)?)?)
POSREAL [0-9]+(.[0-9]+)?
DELAYS (%{POSREAL}[/]*)+
DSN %{NONNEGINT}.%{NONNEGINT}.%{NONNEGINT}
STATUS sent|deferred|bounced|expired
@diginc
diginc / .bashrc-history
Last active August 29, 2015 14:15
History options in bashrc ubuntu default file
$ grep -ri hist ~/.bashrc | grep -v alias
# don't put duplicate lines or lines starting with space in the history.
#HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
#HISTSIZE=1000
#HISTFILESIZE=2000
export HISTSIZE=100000
export HISTFILESIZE=50000
@diginc
diginc / .bash_aliases
Last active August 29, 2015 14:04
docker bash aliases
alias sdo='sudo docker'
function dockinfo {
if [ -z "$1" ] ; then
echo "dockinfo usage: dockinfo <container> [inspect format string]"
echo -e """ Example inspection elements:\n "Args"\n "Config"\n "Created"\n "Driver"\n "ExecDriver"\n "HostConfig"\n "HostnamePath"\n "HostsPath"\n "Id"\n "Image"\n "MountLabel"\n "Name"\n "NetworkSettings"\n "Path"\n "ProcessLabel"\n "ResolvConfPath"\n "State"\n "Volumes"\n "VolumesRW"\n"""
# Generated list with: sudo docker inspect test_jenkins | grep -Po '^ {4}"\w+"'
kill -INT $$
else
CONTAINER="$1"
@diginc
diginc / my_puppet.pp
Created July 15, 2014 00:17
puppet workshop
# Requires modules: puppetlabs-apache, puppetlabs-mysql
exec { 'apt_get_update':
command => '/usr/bin/apt-get update',
}
->
Package <| |>
# Default
Exec {
@diginc
diginc / .bash_aliases
Created May 14, 2014 18:49
tmux session start / resume function
function tm {
TMUXNAME=${1:-"default"}
if tmux ls | grep "^$TMUXNAME:"; then
tmux attach -d -t $TMUXNAME
else
tmux new -s $TMUXNAME
fi
}