Skip to content

Instantly share code, notes, and snippets.

// Configs
S.cfga({
"defaultToCurrentScreen" : true,
"secondsBetweenRepeat" : 0.1,
"checkDefaultsOnLoad" : true,
"focusCheckWidthMax" : 3000,
"orderScreensLeftToRight" : true
});
// Monitors
alias dt='date +"%Y-%m-%d %H:%M:%S %z";TZ=UTC date +"%Y-%m-%d %H:%M:%S %z"'
grant {
permission java.security.AllPermission;
};
import java.util.List;
import java.util.ArrayList;
public class RunOutOfHeap {
public static void main(String[] args) {
// Allocate 1MB buffers until we run out of space
final List<byte[]> buffers = new ArrayList<byte[]>();
while (true) {
buffers.add(new byte[1024 * 1024]);
import java.util.List;
import java.util.LinkedList;
import java.util.Random;
public class AllocateAndGC {
public static void main(String[] args) {
while (true) {
// Allocate some objects
List<Integer> numbers = allocateToHeap(Integer.parseInt(args[0]));
user@host:tutorial$ ls
AllocateToHeap.java
user@host:tutorial$ javac AllocateToHeap.java
user@host:tutorial$ ls
AllocateToHeap.class AllocateToHeap.java
user@host:tutorial$ java AllocateToHeap
Outputting: 1
Outputting: 2
public class AllocateToHeap {
public static void main(String[] args) {
// Using the `new` keyword, I've allocated some objects to the heap
final Integer heapObject1 = new Integer(1);
final Integer heapObject2 = new Integer(2);
// Calling a function, I've passed references to these objects on the stack
output(heapObject1);
output(heapObject2);
}
#!/bin/bash
#
# The "post-receive" script is run after receive-pack has accepted a pack
# and the repository has been updated. It is passed arguments in through
# stdin in the form
# <oldrev> <newrev> <refname>
# For example:
# aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master
fifo="/tmp/gitbotmercuryfifo"
@cfournie
cfournie / .gitconfig
Last active December 10, 2015 00:59
A portion of my usual git config containing aliases picked from http://durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/
[push]
default = current
[alias]
ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --numstat
lnc = log --pretty=format:"%h\\ %s\\ [%cn]"
lds = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=short
ld = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%Cblue\\ [%cn]" --decorate --date=relative
le = log --oneline --decorate
filelog = log -u
@cfournie
cfournie / .slate
Created December 18, 2012 16:18 — forked from anonymous/.slate
# Slate config file
# Author: Chris Fournier <chris.m.fournier@gmail.com>
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Abstract positions
alias full move screenOriginX;screenOriginY screenSizeX;screenSizeY
alias lefthalf move screenOriginX;screenOriginY screenSizeX/2;screenSizeY