๐ค
This file contains hidden or 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
def signum[N](i:N)(implicit n:Numeric[N]):Int = n.compare(i,n.fromInt(0)) | |
def signum[N](i:N)(implicit n:Numeric[N]):Int = n.signum(i) | |
This file contains hidden or 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 | |
# Assumes pngs are in images/ under ./*.css | |
# Edits the files in-place. Make backups. | |
CSSD=${1:-${CSSD:-.}} | |
for c in $(ls ${CSSD}/*.css 2>/dev/null); do | |
for i in ${CSSD}/images/*.png; do | |
p=$(basename $i) | |
b="$(base64 ${i})" | |
perl -pi -e "s|images/${p}|data:image/png;base64,${b}|" ${c} | |
done |
This file contains hidden or 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
<html> | |
<head> | |
<title>PURE Unobtrusive Rendering Engine</title> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | |
<script src="https://raw.github.com/pure/pure/master/libs/pure_min.js"></script> | |
</head> | |
<body> | |
<!-- | |
data-pure-declare are converted into Pure directives and |
This file contains hidden or 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 | |
cd /tmp | |
cat >t.java <<CLASS | |
class t { public static void main(String...args) { | |
System.out.println(System.currentTimeMillis()+"\n"+System.nanoTime()); } } | |
CLASS | |
uname -rvsp | |
date -u | |
date +%s | |
javac t.java && java -cp . t |
This file contains hidden or 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 | |
# 1. Configure ~/.ssh/config with a "git" host. | |
# 2. curl https://raw.github.com/gist/3111363/server-config.git.sh | sh | |
# - step 2 will download this local script here and place the remote script | |
# Usage: ./local-new.git.sh project-name | |
[ "${1}" ] || { | |
echo "Usage: $0 repository-name" | |
exit 1 | |
} |
This file contains hidden or 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 scala.collection.JavaConversions.propertiesAsScalaMapimport | |
(scala.collection.SortedMap[String,String]() ++ System.getProperties()) map(s=>printf("%%%ds | %%s\n".format(System.getProperties().toMap.keySet.foldLeft(0)((i,s) => i max s.length)),s._1,s._2)) |
This file contains hidden or 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 | |
# curl -Lks https://raw.github.com/gist/3889839/jenkins.sh | sudo sh -s | |
# from http://mattonrails.wordpress.com/2011/06/08/jenkins-homebrew-mac-daemo/ | |
# open http://localhost:8080 | |
brew list jenkins || brew install jenkins | |
mkdir /var/jenkins | |
/usr/sbin/dseditgroup -o create -r 'Jenkins CI Group' -i 600 _jenkins | |
dscl . -append /Groups/_jenkins passwd "*" | |
dscl . -create /Users/_jenkins | |
dscl . -append /Users/_jenkins RecordName jenkins |
This file contains hidden or 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 | |
# curl -Lk https://gist.github.com/raw/3906498/db.sh | sh -s mydb myuser | |
db=${1:-mydb}; shift | |
us=${1:-auser}; shift | |
createdb ${db} | |
psql -d ${db} | |
createuser -s -e ${us} |
This file contains hidden or 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 | |
curl -Lks https://raw.github.com/gist/3962627/add.sh | sudo sh -s tomcat |
This file contains hidden or 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 | |
# e.g. | |
# curl -Lks https://raw.github.com/gist/3962627/add.sh | sudo sh -s tomcat | |
user=${1} | |
mkdir /var/${user} | |
/usr/sbin/dseditgroup -o create -r "${user} Group" -i 700 _${user} | |
dscl . -append /Groups/_${user} passwd "*" | |
dscl . -create /Users/_${user} | |
dscl . -append /Users/_${user} RecordName ${user} | |
dscl . -append /Users/_${user} RealName "${user}" |