fixed up the ssh_agent fixer. updated some of the debian stuff.
This commit is contained in:
parent
caf785b53b
commit
da4104da8d
17
.debian
17
.debian
@ -1,16 +1,5 @@
|
|||||||
sudo -v
|
INSTALL="sudo apt-get -y install"
|
||||||
INSTALL="apt-get -y install"
|
|
||||||
$INSTALL zsh
|
$INSTALL zsh
|
||||||
$INSTALL tmux
|
$INSTALL tmux
|
||||||
$INSTALL emacs
|
$INSTALL emacs24-nox
|
||||||
$INSTALL nmap
|
$INSTALL nmap
|
||||||
$INSTALL readline
|
|
||||||
|
|
||||||
# python dependencies
|
|
||||||
$INSTALL libreadline5-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
|
|
||||||
cd ~/Downloads
|
|
||||||
wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
|
|
||||||
tar -xvf Python-2.7.2.tgz && cd Python-2.7.2/
|
|
||||||
./configure
|
|
||||||
make
|
|
||||||
sudo make altinstall
|
|
8
.exports
8
.exports
@ -21,10 +21,4 @@ export LESS_TERMCAP_md="$ORANGE"
|
|||||||
export MANPAGER="less -X"
|
export MANPAGER="less -X"
|
||||||
|
|
||||||
git config --global user.name "Ivan Malison"
|
git config --global user.name "Ivan Malison"
|
||||||
git config --global user.email IvanMalison@gmail.com
|
git config --global user.email IvanMalison@gmail.com
|
||||||
|
|
||||||
# EC2 stuff.
|
|
||||||
export JAVA_HOME="$(/usr/libexec/java_home)"
|
|
||||||
export EC2_PRIVATE_KEY="$(/bin/ls "$HOME"/.ec2/pk-*.pem | /usr/bin/head -1)"
|
|
||||||
export EC2_CERT="$(/bin/ls "$HOME"/.ec2/cert-*.pem | /usr/bin/head -1)"
|
|
||||||
export EC2_HOME="/usr/local/Library/LinkedKegs/ec2-api-tools/jars"
|
|
154
.functions
154
.functions
@ -1,136 +1,142 @@
|
|||||||
source ~/ssh-find-agent/ssh-find-agent.bash
|
find_all_ssh_agent_sockets() {
|
||||||
|
find /tmp -type s -name agent.\* 2> /dev/null | grep '/tmp/ssh-.*/agent.*'
|
||||||
|
}
|
||||||
|
|
||||||
|
set_ssh_agent_socket() {
|
||||||
|
export SSH_AUTH_SOCK=$(find_all_ssh_agent_sockets | tail -n 1 | awk -F: '{print $1}')
|
||||||
|
}
|
||||||
|
|
||||||
# Simple calculator
|
# Simple calculator
|
||||||
function calc() {
|
function calc() {
|
||||||
local result=""
|
local result=""
|
||||||
result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')"
|
result="$(printf "scale=10;$*\n" | bc --mathlib | tr -d '\\\n')"
|
||||||
# └─ default (when `--mathlib` is used) is 20
|
# └─ default (when `--mathlib` is used) is 20
|
||||||
#
|
#
|
||||||
if [[ "$result" == *.* ]]; then
|
if [[ "$result" == *.* ]]; then
|
||||||
# improve the output for decimal numbers
|
# improve the output for decimal numbers
|
||||||
printf "$result" |
|
printf "$result" |
|
||||||
sed -e 's/^\./0./' `# add "0" for cases like ".5"` \
|
sed -e 's/^\./0./' `# add "0" for cases like ".5"` \
|
||||||
-e 's/^-\./-0./' `# add "0" for cases like "-.5"`\
|
-e 's/^-\./-0./' `# add "0" for cases like "-.5"`\
|
||||||
-e 's/0*$//;s/\.$//' # remove trailing zeros
|
-e 's/0*$//;s/\.$//' # remove trailing zeros
|
||||||
else
|
else
|
||||||
printf "$result"
|
printf "$result"
|
||||||
fi
|
fi
|
||||||
printf "\n"
|
printf "\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create a new directory and enter it
|
# Create a new directory and enter it
|
||||||
function mkd() {
|
function mkd() {
|
||||||
mkdir -p "$@" && cd "$@"
|
mkdir -p "$@" && cd "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Determine size of a file or total size of a directory
|
# Determine size of a file or total size of a directory
|
||||||
function fs() {
|
function fs() {
|
||||||
if du -b /dev/null > /dev/null 2>&1; then
|
if du -b /dev/null > /dev/null 2>&1; then
|
||||||
local arg=-sbh
|
local arg=-sbh
|
||||||
else
|
else
|
||||||
local arg=-sh
|
local arg=-sh
|
||||||
fi
|
fi
|
||||||
if [[ -n "$@" ]]; then
|
if [[ -n "$@" ]]; then
|
||||||
du $arg -- "$@"
|
du $arg -- "$@"
|
||||||
else
|
else
|
||||||
du $arg .[^.]* *
|
du $arg .[^.]* *
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Use Git’s colored diff when available
|
# Use Git’s colored diff when available
|
||||||
hash git &>/dev/null
|
hash git &>/dev/null
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
function diff() {
|
function diff() {
|
||||||
git diff --no-index --color-words "$@"
|
git diff --no-index --color-words "$@"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create a data URL from a file
|
# Create a data URL from a file
|
||||||
function dataurl() {
|
function dataurl() {
|
||||||
local mimeType=$(file -b --mime-type "$1")
|
local mimeType=$(file -b --mime-type "$1")
|
||||||
if [[ $mimeType == text/* ]]; then
|
if [[ $mimeType == text/* ]]; then
|
||||||
mimeType="${mimeType};charset=utf-8"
|
mimeType="${mimeType};charset=utf-8"
|
||||||
fi
|
fi
|
||||||
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')"
|
echo "data:${mimeType};base64,$(openssl base64 -in "$1" | tr -d '\n')"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start an HTTP server from a directory, optionally specifying the port
|
# Start an HTTP server from a directory, optionally specifying the port
|
||||||
function server() {
|
function server() {
|
||||||
local port="${1:-8000}"
|
local port="${1:-8000}"
|
||||||
sleep 1 && open "http://localhost:${port}/" &
|
sleep 1 && open "http://localhost:${port}/" &
|
||||||
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
|
# Set the default Content-Type to `text/plain` instead of `application/octet-stream`
|
||||||
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
|
# And serve everything as UTF-8 (although not technically correct, this doesn’t break anything for binary files)
|
||||||
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
|
python -c $'import SimpleHTTPServer;\nmap = SimpleHTTPServer.SimpleHTTPRequestHandler.extensions_map;\nmap[""] = "text/plain";\nfor key, value in map.items():\n\tmap[key] = value + ";charset=UTF-8";\nSimpleHTTPServer.test();' "$port"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Start a PHP server from a directory, optionally specifying the port
|
# Start a PHP server from a directory, optionally specifying the port
|
||||||
# (Requires PHP 5.4.0+.)
|
# (Requires PHP 5.4.0+.)
|
||||||
function phpserver() {
|
function phpserver() {
|
||||||
local port="${1:-4000}"
|
local port="${1:-4000}"
|
||||||
local ip=$(ipconfig getifaddr en1)
|
local ip=$(ipconfig getifaddr en1)
|
||||||
sleep 1 && open "http://${ip}:${port}/" &
|
sleep 1 && open "http://${ip}:${port}/" &
|
||||||
php -S "${ip}:${port}"
|
php -S "${ip}:${port}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Compare original and gzipped file size
|
# Compare original and gzipped file size
|
||||||
function gz() {
|
function gz() {
|
||||||
local origsize=$(wc -c < "$1")
|
local origsize=$(wc -c < "$1")
|
||||||
local gzipsize=$(gzip -c "$1" | wc -c)
|
local gzipsize=$(gzip -c "$1" | wc -c)
|
||||||
local ratio=$(echo "$gzipsize * 100/ $origsize" | bc -l)
|
local ratio=$(echo "$gzipsize * 100/ $origsize" | bc -l)
|
||||||
printf "orig: %d bytes\n" "$origsize"
|
printf "orig: %d bytes\n" "$origsize"
|
||||||
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio"
|
printf "gzip: %d bytes (%2.2f%%)\n" "$gzipsize" "$ratio"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL.
|
# Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL.
|
||||||
# Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!)
|
# Send a fake UA string for sites that sniff it instead of using the Accept-Encoding header. (Looking at you, ajax.googleapis.com!)
|
||||||
function httpcompression() {
|
function httpcompression() {
|
||||||
encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding"
|
encoding="$(curl -LIs -H 'User-Agent: Mozilla/5 Gecko' -H 'Accept-Encoding: gzip,deflate,compress,sdch' "$1" | grep '^Content-Encoding:')" && echo "$1 is encoded using ${encoding#* }" || echo "$1 is not using any encoding"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Syntax-highlight JSON strings or files
|
# Syntax-highlight JSON strings or files
|
||||||
# Usage: `json '{"foo":42}'` or `echo '{"foo":42}' | json`
|
# Usage: `json '{"foo":42}'` or `echo '{"foo":42}' | json`
|
||||||
function json() {
|
function json() {
|
||||||
if [ -t 0 ]; then # argument
|
if [ -t 0 ]; then # argument
|
||||||
python -mjson.tool <<< "$*" | pygmentize -l javascript
|
python -mjson.tool <<< "$*" | pygmentize -l javascript
|
||||||
else # pipe
|
else # pipe
|
||||||
python -mjson.tool | pygmentize -l javascript
|
python -mjson.tool | pygmentize -l javascript
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# All the dig info
|
# All the dig info
|
||||||
function digga() {
|
function digga() {
|
||||||
dig +nocmd "$1" any +multiline +noall +answer
|
dig +nocmd "$1" any +multiline +noall +answer
|
||||||
}
|
}
|
||||||
|
|
||||||
# Escape UTF-8 characters into their 3-byte format
|
# Escape UTF-8 characters into their 3-byte format
|
||||||
function escape() {
|
function escape() {
|
||||||
printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u)
|
printf "\\\x%s" $(printf "$@" | xxd -p -c1 -u)
|
||||||
echo # newline
|
echo # newline
|
||||||
}
|
}
|
||||||
|
|
||||||
# Decode \x{ABCD}-style Unicode escape sequences
|
# Decode \x{ABCD}-style Unicode escape sequences
|
||||||
function unidecode() {
|
function unidecode() {
|
||||||
perl -e "binmode(STDOUT, ':utf8'); print \"$@\""
|
perl -e "binmode(STDOUT, ':utf8'); print \"$@\""
|
||||||
echo # newline
|
echo # newline
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get a character’s Unicode code point
|
# Get a character’s Unicode code point
|
||||||
function codepoint() {
|
function codepoint() {
|
||||||
perl -e "use utf8; print sprintf('U+%04X', ord(\"$@\"))"
|
perl -e "use utf8; print sprintf('U+%04X', ord(\"$@\"))"
|
||||||
echo # newline
|
echo # newline
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add note to Notes.app (OS X 10.8)
|
# Add note to Notes.app (OS X 10.8)
|
||||||
# Usage: `note 'foo'` or `echo 'foo' | note`
|
# Usage: `note 'foo'` or `echo 'foo' | note`
|
||||||
function note() {
|
function note() {
|
||||||
local text
|
local text
|
||||||
if [ -t 0 ]; then # argument
|
if [ -t 0 ]; then # argument
|
||||||
text="$1"
|
text="$1"
|
||||||
else # pipe
|
else # pipe
|
||||||
text=$(cat)
|
text=$(cat)
|
||||||
fi
|
fi
|
||||||
body=$(echo "$text" | sed -E 's|$|<br>|g')
|
body=$(echo "$text" | sed -E 's|$|<br>|g')
|
||||||
osascript >/dev/null <<EOF
|
osascript >/dev/null <<EOF
|
||||||
tell application "Notes"
|
tell application "Notes"
|
||||||
tell account "iCloud"
|
tell account "iCloud"
|
||||||
tell folder "Notes"
|
tell folder "Notes"
|
||||||
@ -144,13 +150,13 @@ EOF
|
|||||||
# Add reminder to Reminders.app (OS X 10.8)
|
# Add reminder to Reminders.app (OS X 10.8)
|
||||||
# Usage: `remind 'foo'` or `echo 'foo' | remind`
|
# Usage: `remind 'foo'` or `echo 'foo' | remind`
|
||||||
function remind() {
|
function remind() {
|
||||||
local text
|
local text
|
||||||
if [ -t 0 ]; then
|
if [ -t 0 ]; then
|
||||||
text="$1" # argument
|
text="$1" # argument
|
||||||
else
|
else
|
||||||
text=$(cat) # pipe
|
text=$(cat) # pipe
|
||||||
fi
|
fi
|
||||||
osascript >/dev/null <<EOF
|
osascript >/dev/null <<EOF
|
||||||
tell application "Reminders"
|
tell application "Reminders"
|
||||||
tell the default list
|
tell the default list
|
||||||
make new reminder with properties {name:"$text"}
|
make new reminder with properties {name:"$text"}
|
||||||
@ -161,7 +167,7 @@ EOF
|
|||||||
|
|
||||||
# Manually remove a downloaded app or file from the quarantine
|
# Manually remove a downloaded app or file from the quarantine
|
||||||
function unquarantine() {
|
function unquarantine() {
|
||||||
for attribute in com.apple.metadata:kMDItemDownloadedDate com.apple.metadata:kMDItemWhereFroms com.apple.quarantine; do
|
for attribute in com.apple.metadata:kMDItemDownloadedDate com.apple.metadata:kMDItemWhereFroms com.apple.quarantine; do
|
||||||
xattr -r -d "$attribute" "$@"
|
xattr -r -d "$attribute" "$@"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
5
.gitmodules
vendored
5
.gitmodules
vendored
@ -6,7 +6,4 @@
|
|||||||
url = git@github.com:IvanMalison/.emacs.d.git
|
url = git@github.com:IvanMalison/.emacs.d.git
|
||||||
[submodule "oh-my-zsh"]
|
[submodule "oh-my-zsh"]
|
||||||
path = oh-my-zsh
|
path = oh-my-zsh
|
||||||
url = git@github.com:IvanMalison/oh-my-zsh.git
|
url = git@github.com:IvanMalison/oh-my-zsh.git
|
||||||
[submodule "ssh-find-agent"]
|
|
||||||
path = ssh-find-agent
|
|
||||||
url = git@github.com:wwalker/ssh-find-agent.git
|
|
2
setup.sh
2
setup.sh
@ -52,8 +52,6 @@ function install_python_packages() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sudo -v
|
|
||||||
[ "$1" == "--install" -o "$1" == "-i" ] && echo "Installing essential files." && install_essentials
|
|
||||||
echo "Installing Dot Files."
|
echo "Installing Dot Files."
|
||||||
source bootstrap.sh
|
source bootstrap.sh
|
||||||
echo "Installing Tmux Configuration."
|
echo "Installing Tmux Configuration."
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit ecb780effadc3e95e5e5b9997448294f784def96
|
|
Loading…
Reference in New Issue
Block a user