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.util.Arrays; | |
public class MergeSorter { | |
private long inversions = 0; | |
public void sort(int[] array) { | |
int length = array.length; | |
if (length <= 1) { | |
return; |
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
public class TowerofHanoi | |
{ | |
public static void main(String...args) { | |
int nDisks = 3; | |
doTowers(nDisks, 'A', 'B', 'C'); | |
} |
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
package ffbit.sorting; | |
import java.util.Arrays; | |
public class QuickSorter implements Sorter { | |
@Override | |
public void sort(int[] array) { | |
System.out.println(Arrays.toString(array)); | |
sort(array, 0, array.length); |
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 | |
DB="dbname" | |
HOST="host" | |
UNAME="uname" | |
dropdb --host $HOST --port=5432 --username $UNAME $DB | |
createdb --host $HOST --port 5432 --username $UNAME --owner $UNAME $DB |
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
# http://docs.rubygems.org/read/chapter/11 | |
install: --no-rdoc --no-ri | |
update: --no-rdoc --no-ri |
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.util.LinkedList; | |
import java.util.Queue; | |
import java.util.Scanner; | |
public class GC { | |
private static Queue<Object> queue = new LinkedList<Object>(); | |
private static Scanner scanner = new Scanner(System.in); | |
public static void main(String...args) { |
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.util.Arrays; | |
import java.util.Random; | |
public class RandomMatrix { | |
public static void main(String... args) { | |
double[][][] matrix = getMatrix(40); | |
print(matrix); | |
} |
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
log.debug("Started extracting resources."); | |
final String ZIP_FILE_PATH_SEPARATOR = "/"; | |
URL location = AClassFromTheNeededJar.class.getProtectionDomain().getCodeSource() | |
.getLocation(); | |
String jarPath = location.getPath(); | |
try { | |
JarInputStream jar = new JarInputStream(new FileInputStream(jarPath)); | |
JarEntry jarEntry = null; |
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 | |
java_path=$(readlink -f `which java`) | |
export JAVA_HOME=$(dirname `dirname $java_path`) | |
export PATH=$PATH:$JAVA_HOME/bin |
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 | |
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) | |
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile | |
source ~/.bash_profile | |
rvm pkg install openssl | |
rvm pkg install zlib | |
rvm pkg install autoconf |
OlderNewer