This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# dns-cleanup.sh | |
# certbot hook to use nsupdate to send the validation to an Active Directory DNS server | |
nsupdate -g << EOF | |
update delete _acme-challenge.$CERTBOT_DOMAIN TXT | |
send | |
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdbool.h> | |
#include "image.h" | |
void finished(wkhtmltoimage_converter * converter, int p) { | |
printf("Finished: %d\n", p); | |
} | |
void progress_changed(wkhtmltoimage_converter * converter, int p) { | |
printf("%3d\n", p); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# solve-critters.py | |
grid = ["bbbbbbbbbbbbbbbbbbbboobboobboobboobboobboobbbbbbbbbbbbbbbbbbbbbb", | |
"bbbbbbbbbbbbbbbbbobbbbbbbbbbbbbbbbbbbbbbbbbbobbbbbbbbbbbbbbbbbbb", | |
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", | |
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", | |
"bbbbbbbbbbbbbbbbbobbbbbbbbbbbbbbbbbbbbbbbbbbobbbbbbbbbbbbbbbbbbb", | |
"bbbbbbbbbbbbboboboobbbbbbbbbbobbobbbbbbbbbboobobobbbbbbbbbbbbbbb", | |
"bbbbbbbbbbbbbbbboobbbbbbbbbbbbbbbbbbbbbbbbbboobbbbbbbbbbbbbbbbbb", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# SEE WRITEUP AT https://davi.dyoung.tech/index.php/posts/configuring-smartos-as-a-router-with-ospf-and-dhcp | |
echo "This is the mega router installer script. Yay!" | |
# find out whether we're a one-nic router or a two-nic router | |
read -p "How many nics do we have? [1/2] " nicn | |
case $nicn in | |
1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# arguments are type, address, hardware, name | |
LOGFILE=/tmp/dns.log | |
SUFFIX=".clients.example.com." | |
APIKEY="SUPERsecretAPIkey" | |
APIPORT=8081 | |
APIADDRESS="10.0.0.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import urllib2 | |
import re | |
import ssl | |
import sys | |
# # find generic mirrors | |
mirrors = urllib2.urlopen('http://www.debian.org/mirror/list') | |
https = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import itertools | |
def pairwise_combine(array): | |
for i in xrange(len(array)-1): | |
arr = array[:i] + [''.join(array[i:i+2])] + array[i+2:] | |
yield arr | |
array = [j for j in "123456789"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Utility for converting the output of ethereum-decompile into a nice | |
# lstlisting format. Requires the following code somewhere before it: | |
# \let\othelstnumber=\thelstnumber | |
# \def\createlinenumber#1#2{ | |
# \edef\thelstnumber{% | |
# \unexpanded{% | |
# \ifnum#1=\value{lstnumber}\relax | |
# #2% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Sections should each have a ${section}.tex in . and a ${section} directory | |
# containing their subsections and other content. | |
function openall { | |
if [[ -f "$1.tex" ]] ; then | |
OPT="$1.tex" | |
else | |
OPT="" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
multipliers = Dict("w" => 1, # wei | |
"sh" => 1000000000, # shannon | |
"z" => 1000000000000, # szabo | |
"f" => 1000000000000000, # finney | |
"t" => 1000000000000000000) # eth | |
# smallest substrings to search for that uniquely identify | |
function UnitToWei(st) | |
pos = search(st,' ') # get index of space | |
if pos == 0 # we are already in wei |
NewerOlder