blocks = []
while True:
block = f.read(32)
if block == '':
break
blocks.append(block)
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 | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
git clone https://github.com/1tayH/noisy.git && cd noisy | |
readonly __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
curl -sSL "http://s3.amazonaws.com/alexa-static/top-1m.csv.zip" | tar xvfz - -C ${__dir} | |
python - <<EOF | |
import json | |
import csv |
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
zip myfiles d0 | |
(cd f1; zip -u ../myfiles.zip d1) | |
(cd f2/f3; zip -u ../../myfiles.zip d4) | |
# example | |
# zip project3.zip -j a/*.hdl | |
# (cd b; zip -u ../project3.zip *.hdl) | |
# The parentheses create subshells, and the effect of the cd only lasts in the subshell, | |
# so you don't have to cd back to the original directory. |
Install the CLI
sudo apt-get install python-pip
sudo pip install awscli
# upgrade
sudo pip install --upgrade awscli
E: Unable to locate package [xxx]
apt-get update
apt-get install apt-file
apt-file update
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
from itertools import chain | |
def get_behind_chars(c, pool): | |
behind = [] | |
for item in pool: | |
if c in item: | |
chars = item[item.index(c):] | |
[behind.append(_) for _ in chars if _ != c] | |
return list(set(behind)) |
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
<input id=username type="text" placeholder="github username or repo link"> | |
<button onclick="fetch(`https://api.github.com/users/${username.value.replace(/^.*com[/]([^/]*).*$/,'$1')}/events/public`).then(e=> e.json()).then(e => [...new Set([].concat.apply([],e.filter(x => x.type==='PushEvent').map(x => x.payload.commits.map(c => c.author.email)))).values()]).then(x => results.innerText = x)">GO</button> | |
<div id=results></div> |
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 latest version from https://bitbucket.org/iBotPeaches/apktool/downloads | |
export apktool_version=2.4.0 | |
sudo -E sh -c 'wget https://bitbucket.org/iBotPeaches/apktool/downloads/apktool_$apktool_version.jar -O /usr/local/bin/apktool.jar' | |
sudo chmod +r /usr/local/bin/apktool.jar | |
sudo sh -c 'wget https://raw.githubusercontent.com/iBotPeaches/Apktool/master/scripts/linux/apktool -O /usr/local/bin/apktool' | |
sudo chmod +x /usr/local/bin/apktool | |
# To use: | |
# apktool d TelephonyProvider.apk -o TelephonyProvider |
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 | |
set -o errexit | |
set -o pipefail | |
set -o nounset | |
curl -sSL "http://s3.amazonaws.com/alexa-static/top-1m.csv.zip" | tar xvfz - -C . | |
python - <<EOF | |
import json |