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
# An example struct. | |
defmodule Coin do | |
# Using Kernel.put_in/3 and other methods requires the target to have the Access behaviour. | |
@behaviour Access | |
# Structs by default do not implement this. It's easy to delegate this to the Map implementation however. | |
defdelegate get(coin, key, default), to: Map | |
defdelegate fetch(coin, key), to: Map | |
defdelegate get_and_update(coin, key, func), to: Map | |
defdelegate pop(coin, key), to: Map |
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/env bash | |
LIBSSL_FILE="libssl1.0.2_1.0.2o-1_amd64.deb" | |
wget "http://ftp.us.debian.org/debian/pool/main/o/openssl1.0/$LIBSSL_FILE" | |
sudo dpkg -i "$LIBSSL_FILE" | |
sudo ln -s "/usr/lib/x86_64-linux-gnu/libssl.so.1.0.2" /opt/HipChat4/lib/libssl.so | |
rm "$LIBSSL_FILE" |
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/sh | |
BUILD="3131" | |
SHORTCUT="[Desktop Entry] | |
Name=Sublime Text 3 | |
Comment=Edit text files | |
Exec=/usr/local/sublime-text-3/sublime_text | |
Icon=/usr/local/sublime-text-3/Icon/128x128/sublime-text.png | |
Terminal=false |
I hereby claim:
- I am andykingking on github.
- I am andykingking (https://keybase.io/andykingking) on keybase.
- I have a public key ASBuqS9qWZ4fwp-wYAa291-Il_R9NWcBQUE8qHkmrf14ago
To claim this, I am signing this object:
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 json | |
import subprocess | |
def fetch_value(key): | |
return subprocess.check_output(['credstash', '-r', data['region'], '-t', data['table'], 'get', key]) | |
def create_shell_command(variable, credential): | |
value = fetch_value(credential) | |
return 'export {0}="{1}"'.format(variable, value) |
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
require 'sys/proctable' | |
module ProcTableGrep | |
def exist? | |
Sys::ProcTable.ps.each do |p| | |
return true if p.cmdline.include? @pgrep | |
end | |
false | |
end | |
end |
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
def sørensen_index(string_a, string_b) | |
matches_a = get_bigrams string_a.dup | |
matches_b = get_bigrams string_b.dup | |
similarities = matches_a & matches_b | |
sum_bigrams = matches_a.count + matches_b.count | |
2 * similarities.count / sum_bigrams.to_f | |
end | |
def get_bigrams(str) | |
bigrams = [] |
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 | |
# output all files in index that haven't been garbage collected | |
git fsck --cache --unreachable $(git for-each-ref --format="%(objectname)") > badfiles | |
# output all files by showing them via sub-hash | |
FILENUM=1 | |
cat badfiles | cut -c 18-24 | while read cur | |
do | |
git show $cur > $FILENUM |
NewerOlder