View thestoryofus.sh
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 | |
dir=$(mktemp --directory) | |
declare -a input=() | |
cat <<__EOT__ > ${dir}/metadata.txt | |
--- | |
title: The Story of Us | |
author: Tim Urban | |
rights: Creative Commons Non-Commercial Share Alike 3.0 |
View ford-m.js
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
// radio code generator for ford radio with serial starting with "M" | |
// stolen from https://github.com/OlegSmelov/ford-radio-codes | |
// get the radio serial by holding 1+6 while powering radio on | |
'use strict'; | |
function generateSerial(serial) { | |
const lookup = [ | |
[9, 5, 3, 4, 8, 7, 2, 6, 1, 0], | |
[2, 1, 5, 6, 9, 3, 7, 0, 4, 8], |
View certbot-authhook-az-cli-annotated.sh
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 | |
# The hook supports 2 actions, 'create' and 'delete', passed as the first argument. | |
# When 'create' is passed in, a validation TXT record is added, | |
# 'delete' cleans up that record after validation | |
ACTION=$1 | |
# The second the name of the Azure Account that contains the DNS Zone Resource | |
AZ_ACCOUNT=$2 | |
echo $AZ_ACCOUNT | |
# set the name of the Azure Resource Group that contains the DNS Zone Resource |
View nginx.conf
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
http { | |
#access_log logs/access.log main; | |
# parse \d{4}-\d{2} from $time_iso8601 into $yyyy_mm | |
map $time_iso8601 $yyyy_mm { | |
"~^(?<temp>\d{4}-\d{2})" $temp; | |
} | |
server { | |
listen 80; |
View Test.java
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
import javax.crypto.Cipher; | |
class Test { | |
public static void main(String[] args) { | |
try { | |
System.out.println("Hello World!"); | |
int maxKeyLen = Cipher.getMaxAllowedKeyLength("AES"); | |
System.out.println(maxKeyLen); | |
} catch (Exception e){ | |
System.out.println("Sad world :("); |
View gist:6d58f2e9a77e1aa2581d21e39b4411d9
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
sublimetext ebook merge paragraphs regexp pattern | |
search pattern: | |
(\n\n)([\w]) | |
replace pattern: | |
\2 | |
before: | |
„Elfové a draci, řek jsem svýmu klukovi, zelí a brambory jsou pro nás |
View xva2raw.sh
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 | |
# stolen from now defunct http://wiki.sysconfig.org.uk/display/howto/Convert+Citrix+XenServer+images+to+plain+Xen | |
# | |
# To summarize the .xva format: | |
# - it's a tar file | |
# - it contains a folder | |
# - the folder contains chunks of 1MB each | |
# - they can be concatenated, but blank space needs to be filled | |
dd if=/dev/zero of=blank bs=1024 count=1k |
View bashrc.sh
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
# get current branch in git repo | |
function parse_git_branch() { | |
BRANCH=`git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'` | |
if [ ! "${BRANCH}" == "" ] | |
then | |
STAT=`parse_git_dirty` | |
echo "[${BRANCH}${STAT}]" | |
else | |
echo "" | |
fi |
View detect.js
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
var isMobile = { | |
Android: function() { | |
return navigator.userAgent.match(/Android/i); | |
}, | |
BlackBerry: function() { | |
return navigator.userAgent.match(/BlackBerry/i); | |
}, | |
iOS: function() { | |
return navigator.userAgent.match(/iPhone|iPad|iPod/i); | |
}, |
View pfx2cer-key.sh
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
# convert from pfx to passwordless key/crt chain | |
# based on https://gist.github.com/ericharth/8334664 | |
# params | |
PFX="hostname.pfx" | |
PASSWORD="pfxpassword" | |
OUT="hostname-2018" | |
# key | |
openssl pkcs12 -in $PFX -password pass:$PASSWORD -nodes -nocerts -out $OUT.key |
NewerOlder