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
#!/usr/bin/env python | |
import re, os, os.path, sys | |
HOST = '[email protected]' | |
KEYS = '/data/users/jenkins/home/.ssh' | |
if len(sys.argv) != 3: | |
sys.stderr.write('usage: git-ssh host command\n') | |
sys.exit(100) |
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 -eu | |
while true | |
do | |
ssh -o ServerAliveInterval=10 "$@" && exit | |
sleep 5 | |
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
public static DataSize approximateSize(long bytes) | |
{ | |
DataSize size = new DataSize(bytes, DataSize.Unit.BYTE); | |
size = size.convertToMostSuccinctDataSize(); | |
return new DataSize(size.roundTo(size.getUnit()), size.getUnit()); | |
} |
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 -eu | |
export JAVA_HOME=$(/usr/libexec/java_home -v 1.6) | |
export PATH=$JAVA_HOME/bin:$PATH | |
exec "$@" |
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
PHP 5.3.15 (cli) (Aug 24 2012 17:40:23) [Darwin] | |
>>> class Foo { public $x; function __destruct() { echo "destroy\n"; var_dump($this); } } | |
>>> $a = new Foo(); $b = new Foo(); $a->x = $b; $b->x = $a; unset($a); unset($b); | |
>>> gc_collect_cycles() | |
destroy | |
object(Foo)#2 (1) { | |
["x"]=> | |
object(Foo)#1 (1) { | |
["x"]=> | |
*RECURSION* |
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
package javatest; | |
import com.google.common.base.*; | |
import java.util.Arrays; | |
public enum RecursiveEnum | |
{ | |
FOO(null), | |
BAR(FOO); |
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
public String toString() { | |
#set ($autoImportPackages = "com.google.common.base.Objects") | |
return Objects.toStringHelper(this) | |
#foreach ($member in $members) | |
.add("$member.name", $member.accessor) | |
#end | |
.toString(); | |
} |
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
// ==UserScript== | |
// @name Latest Javadoc Redirect | |
// @match http://docs.oracle.com/javase/*/api/* | |
// ==/UserScript== | |
(function() { | |
var oldVersions = ['1.3', '1.4.2', '1.5.0', '1,5.0', '6']; | |
var newVersion = '7'; | |
var url = window.location.toString(); | |
for (var i = 0; i < oldVersions.length; 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
private static List<Path> listMatchingFiles(Path start, String glob) | |
throws IOException | |
{ | |
final ImmutableList.Builder<Path> list = ImmutableList.builder(); | |
final PathMatcher matcher = start.getFileSystem().getPathMatcher("glob:" + glob); | |
Files.walkFileTree(start, new SimpleFileVisitor<Path>() | |
{ | |
@Override | |
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) | |
throws IOException |
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 com.amazonaws.AmazonClientException; | |
import com.amazonaws.services.s3.AmazonS3; | |
import com.amazonaws.services.s3.model.ListObjectsRequest; | |
import com.amazonaws.services.s3.model.S3Object; | |
import com.amazonaws.services.s3.model.S3ObjectSummary; | |
import com.google.common.collect.ImmutableList; | |
import com.google.common.io.InputSupplier; | |
import java.io.IOException; | |
import java.io.InputStream; |