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 difflib | |
import wasabi | |
def diff_strings(a, b): | |
output = [] | |
matcher = difflib.SequenceMatcher(None, a, b) | |
for opcode, a0, a1, b0, b1 in matcher.get_opcodes(): | |
if opcode == "equal": | |
output.append(a[a0:a1]) | |
elif opcode == "insert": |
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 | |
# usage: | |
# first make the file executable | |
# ./word2vec-download300model.sh output-file | |
OUTPUT=$( wget --save-cookies cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=0B7XkCwpI5KDYNlNUTTlSS21pQmM' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/Code: \1\n/p' ) | |
CODE=${OUTPUT##*Code: } | |
echo $CODE |
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 | |
# Borrowed from http://marcparadise.com/blog/2013/09/21/how-to-fix-a-corrupt-history-file/ | |
# If you ever see a message like this upon starting a new shell | |
# zsh: corrupt history file /home/marc/.zsh_history | |
# here is a quick fix | |
cd ~ | |
mv .zsh_history .zsh_history_bad | |
strings .zsh_history_bad > .zsh_history | |
# And reload history | |
fc -R .zsh_history |