Skip to content

Instantly share code, notes, and snippets.

View martint's full-sized avatar

Martin Traverso martint

View GitHub Profile
public class A {
private final int dataSize = (int) (Runtime.getRuntime().maxMemory() * 0.6);
public void f()
{
{
byte[] data = new byte[dataSize];
}
byte[] data2 = new byte[dataSize];
bash_prompt() {
local status=$(git status 2> /dev/null | grep 'working directory clean')
local dirty=''
if [ -z "$status" ]; then
local dirty='*'
fi
local branch=$(git branch 2> /dev/null | grep -e "\* " | sed "s/^..\(.*\)/\1/")
if [ -z "$branch" ]; then
export PS1="[$(date +%H:%M) \u@\[\033[33m\]\h\[\033[39m\]:\w] "
public class X
{
public static void main(String[] args)
throws InterruptedException
{
final Thread t = new Thread(new Runnable() {
@Override
public void run()
{
#!/usr/bin/env ruby
limit = ARGV[0].to_i
result = Array.new(limit)
count = 0
STDIN.each_line do |line|
if count < limit
result[count] = line
VirtualMachineDescriptor virtualMachineDescriptor = VirtualMachine.list().get(0);
MonitoredHost host = MonitoredHost.getMonitoredHost("localhost");
MonitoredVm monitoredVm = host.getMonitoredVm(new VmIdentifier(virtualMachineDescriptor.id()));
System.out.println(MonitoredVmUtil.commandLine(monitoredVm));
#!/bin/bash
function setjdk {
local ver=${1?Usage: setjdk <version>}
export JAVA_HOME=$(/usr/libexec/java_home -v $ver)
PATH=$(echo $PATH | tr ':' '\n' | grep -v Java | tr '\n' ':')
export PATH=$JAVA_HOME/bin:$PATH
}
#!/bin/bash
function setjdk {
local ver=${1?Usage: setjdk <version>}
export JAVA_HOME=$(/usr/libexec/java_home -v $ver)
PATH=$(echo $PATH | tr ':' '\n' | grep -v Java | tr '\n' ':')
export PATH=$JAVA_HOME/bin:$PATH
}
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonTypeIdResolver;
import com.fasterxml.jackson.databind.jsontype.TypeIdResolver;
import com.fasterxml.jackson.databind.type.SimpleType;
import java.io.IOException;