Skip to content

Instantly share code, notes, and snippets.

@AdamBien
AdamBien / 35thAirhacksQ&A.md
Last active Feb 8, 2017
35thAirhacksQ&A.md
View 35thAirhacksQ&A.md
@nicoulaj
nicoulaj / java-signals-test.sh
Created Sep 20, 2012
What signals can your JRE handle ?
View java-signals-test.sh
#!/bin/bash
# Get temp dir
tmpdir=$(mktemp -d)
# Generate test
cat > ${tmpdir}/ListenToSignal.java <<EOF
import sun.misc.Signal;
import sun.misc.SignalHandler;
public class ListenToSignal {
@nolim1t
nolim1t / gist:271018
Created Jan 7, 2010
Sample HTTP Request in Powershell
View gist:271018
Powershell HTTP Request
$r = [System.Net.WebRequest]::Create("http://url/")
$resp = $r.GetResponse()
$reqstream = $resp.GetResponseStream()
$sr = new-object System.IO.StreamReader $reqstream
$result = $sr.ReadToEnd()
write-host $result
Username and passwords
@henrik
henrik / .bashrc
Created Dec 3, 2008
Git branch and dirty state in Bash prompt.
View .bashrc
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
You can’t perform that action at this time.