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 | |
# Profile for Mac OS X systems | |
# Proxy setup ---------------------------------------------------------- | |
export PROXY_HOST=www-proxy.example.com | |
export PROXY_PORT=80 | |
function proxy_reset() { | |
if [ "$1" = "MyCompany On Network" ]; then |
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
cd repository | |
git log --pretty=email --patch-with-stat --reverse --full-index --binary -- path/to/file_or_folder > patch | |
cd ../another_repository | |
git am < ../repository/patch |
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 python | |
import sys | |
def rgb2Yiq(red, green, blue): | |
y = int((0.299 * red) + (0.587 * green) + (0.114 * blue)) | |
i = int((0.596 * red) - (0.275 * green) - (0.321 * blue)) | |
q = int((0.212 * red) - (0.528 * green) + (0.311 * blue)) | |
return (y, i, q) |
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/local/bin/env python | |
import signal | |
import sys | |
packet_size = 188 | |
position = 0 | |
paused = False | |
def pause_handler(signal, frame): |
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
set(SRCS "") | |
macro (add_sources) | |
foreach (_src ${ARGN}) | |
if (_relPath) | |
list (APPEND SRCS "${_src}") | |
else() | |
list (APPEND SRCS "${_src}") | |
endif() | |
endforeach() |
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
ITEMS=( "appletviewer" "apt" "extcheck" "idlj" "jar" "jarsigner" "java" "javac" "javadoc" "javah" "javap" "javaws" "jconsole" "jdb" "jhat" "jinfo" "jmap" "jps" "jrunscript" "jsadebugd" "jstack" "jstat" "jstatd" "keytool" "native2ascii" "orbd" "pack200" "policytool" "rmic" "rmid" "rmiregistry" "schemagen" "serialver" "servertool" "tnameserv" "unpack200" "wsgen" "wsimport" "xjc" ) | |
for ITEM in ${ITEMS[@]}; do | |
rm -f "/usr/bin/$ITEM" | |
ln -s "/System/Library/Frameworks/JavaVM.framework/Commands/$ITEM" "/usr/bin/$ITEM" | |
done |
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 | |
# assuming you just installed Oracle JDK7 in '/Library/Java/JavaVirtualMachines/jdk1.7.0_72.jdk' | |
cd /System/Library/Frameworks/JavaVM.framework/Versions | |
sudo mv CurrentJDK JDK6 | |
# the version number must match the installed version | |
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_72.jdk /Library/Java/JavaVirtualMachines/jdk1.7.0 | |
sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0/Contents JDK7 | |
sudo ln -s JDK7 CurrentJDK | |
sudo cp -r JDK6/Commands JDK7/ |
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 | |
# Toggle proxy settings. | |
# It will be necessary to reload ${HOME}/.profile after running this. | |
USAGE="usage: ${0} on|off|status" | |
if [[ "d${PROXY_FILE}d" == "dd" ]]; then | |
echo "PROXY_FILE undefined" >&2 | |
exit 1 | |
fi |
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 | |
# mac setup automation script based on | |
# http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac | |
# Check for Homebrew, | |
# Install if we don't have it | |
if test ! $(which brew); then | |
echo "Installing homebrew..." | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
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 | |
# List missing files from a web server. Missing means we get a non-200 response. | |
BASE="http://www.example.com" | |
FILES="index.html | |
about.html" | |
for ITEM in ${FILES}; do | |
URL="${BASE}/${ITEM}" |