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 | |
# https://httpd.apache.org/docs/2.2/misc/password_encryptions.html | |
HTPASSWD=$1 | |
USERNAME=$2 | |
PASSWORD=$3 | |
ENTRY=`cat $HTPASSWD | grep "^$USERNAME:"` | |
HASH=`echo $ENTRY | cut -f 2 -d :` | |
SALT=`echo $HASH | cut -f 3 -d $` |
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
[alias] | |
# basic shortcut | |
br = branch | |
ci = commit | |
co = checkout | |
df = diff | |
rb = rebase | |
stat = status | |
# full info |
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 | |
REMOTE=$1 | |
if [[ -z "$REMOTE" ]] ; then | |
REMOTE='origin' | |
fi | |
PARSED=$(git remote -v | grep '(fetch)' | grep "^$REMOTE\t" | awk -F "\t| " '{print $2}' | sed -E -e 's/\.git$//' -e 's/^.+@//') | |
if [[ -z "$PARSED" ]] ; then | |
echo "Cannot find git remote: $REMOTE" |
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 'benchmark' | |
big_number = 1_000_000 | |
a = 1.upto big_number | |
b = big_number.upto big_number * 2 | |
a_array = a.to_a | |
b_array = b.to_a | |
class MultipleEnumerator | |
include Enumerable |
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 | |
for man in 1 3 5 7; do | |
ln -sf /usr/local/lib/node_modules/npm/man/man${man}/* /usr/local/share/man/man${man} | |
done | |
ln -sf /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm | |
npm update npm -g |
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 | |
HAROOPAD_BIN=/opt/homebrew-cask/Caskroom/haroopad/0.10.0/haroopad.app/Contents/MacOS/node-webkit | |
cd $(dirname "$1") | |
ABS_PATH="$(pwd)/$(basename "$1")" | |
exec $HAROOPAD_BIN $ABS_PATH &> /dev/null & |
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 | |
echo "# Update brew" | |
brew update && brew upgrade | |
brew doctor | |
brew cleanup | |
echo "# Update ruby gem" | |
gem update --system && gem 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
require 'benchmark' | |
require 'set' | |
array_size = (ENV['TOTAL'] || 1_000_000).to_i | |
max_int = array_size / 5 | |
array = 1.upto(array_size).map { rand(max_int) } | |
if ENV['CHECK'] | |
@correct = array.group_by { |e| e }.select { |k, v| v.size > 1 }.keys.sort | |
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
#!/bin/bash -eux | |
packer_ver=0.5.2 | |
packer_prefix=/opt | |
packer_arch=linux_amd64 | |
mkdir -p ${packer_prefix}/packer-${packer_ver} | |
cd ${packer_prefix}/packer-${packer_ver} | |
wget https://dl.bintray.com/mitchellh/packer/${packer_ver}_${packer_arch}.zip | |
unzip ${packer_ver}_${packer_arch}.zip && rm ${packer_ver}_${packer_arch}.zip |
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 'benchmark' | |
require 'open3' | |
require 'htauth/md5' | |
SALT = | |
def run_open3 | |
Open3.popen3('htpasswd', '-nbm', 'username', 'password') { | stdin, stdout, stderr | stdout.read }.strip.split(':')[1] | |
end |
OlderNewer