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
// Create a bookmarklet with the following line: | |
// javascript:(function(){document.body.appendChild(document.createElement('script')).src='https://gist.githubusercontent.com/ramn/fa7f13b736f872e6f506/raw/normalize_bookmarklet.js';})(); | |
var s=document.body.style; | |
s.fontFamily='"Optima", "ubuntu light", "lucida grande", verdana'; | |
s.background='#EEEEEE'; | |
s.color='black'; | |
for (i=0; i<document.links.length; i++) { | |
document.links[i].style.color='blue'; |
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
jdbc:postgresql://<host>:<port>/<dbname>?user=<username>&password=<password> |
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 | |
CP="$(find $HOME/.ivy2 -path '*myorg/*util_2.11-*.jar' | tail -1)" | |
exec scala -savecompiled -cp "$CP" $0 $@ | |
!# | |
import com.myorg.MyClass | |
io.Source.stdin | |
.getLines | |
.map { line => |
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 | |
socat -v -T0.05 tcp-l:8081,reuseaddr,fork system:"echo 'HTTP/1.1 200 OK'; echo 'Connection: close'; echo; cat" |
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 | |
# Depends on git, curl, jq | |
BAK_DIR=$(date +"%y%m%d-%H%M") | |
GISTS_URL="https://api.github.com/users/$USER/gists?per_page=1000&access_token=$GITHUB_ACCESS_TOKEN" | |
mkdir "$BAK_DIR" && cd "$BAK_DIR" && curl -s "$GISTS_URL" | jq ".[] | .git_pull_url" | xargs -n1 git clone |
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
// scala -cp $HOME/lib/derby-10.11.1.1.jar:$HOME/lib/derbyclient-10.11.1.1.jar:$HOME/lib/derbynet-10.11.1.1.jar | |
import org.apache.derby.drda.NetworkServerControl | |
import java.net.InetAddress | |
import java.sql.DriverManager | |
val server = new NetworkServerControl(InetAddress.getByName("localhost"),1527) | |
server.start(new java.io.PrintWriter(Console.out)) // here we direct logging to stdout | |
// To create and connect to a db in the same jvm: |
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
def getUnsafeInstance: sun.misc.Unsafe = { | |
val f = classOf[sun.misc.Unsafe].getDeclaredField("theUnsafe") | |
f.setAccessible(true) | |
val unsafe = f.get(null).asInstanceOf[sun.misc.Unsafe] | |
unsafe | |
} |
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 | |
FILE="$1" | |
PORT=${PORT:-9999} | |
MIME_TYPE=$(mimetype "$FILE") | |
SIZE_BYTES=$(du -b "$FILE" | cut -f1) | |
FILE_NAME=$(basename "$FILE") | |
HEADER="\ | |
HTTP/1.1 200 OK |
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
import java.io.ByteArrayInputStream | |
import java.io.ByteArrayOutputStream | |
import scala.sys.process._ | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.Future | |
import scala.concurrent.blocking | |
import scala.concurrent.Await | |
import scala.concurrent.duration._ |
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 | |
rlwrap tr -d '\n\r' | tr -sc [:alnum:] '_' | tr [:upper:] [:lower:] |
NewerOlder