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 DeadlockTest | |
{ | |
public static void main(String[] args) | |
{ | |
final Foo a = new Foo(); | |
final Foo b = new Foo(); | |
new Thread(new Runnable() | |
{ |
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
gource -s .06 -1280x720 --auto-skip-seconds .1 --multi-sampling --stop-at-end --key --highlight-users --hide mouse,progress,files,filenames,dirnames --file-idle-time 0 --max-files 0 --background-colour 000000 --font-size 22 --title "Lucene/Solr" --output-ppm-stream - --output-framerate 30 | avconv -y -r 30 -f image2pipe -vcodec ppm -i - -b 65536K movie.mp4 | |
&& ffmpeg -i movie.mp4 -b:v 3048780 -vcodec libx264 -crf 24 output.mp4 |
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 | |
for i in `ls -d */`; do | |
echo "updating $i" | |
cd $i | |
if [ -d ".git" ]; then | |
git pull origin | |
fi | |
cd - | |
done |
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 com.datastax.driver.core.*; | |
import java.util.Arrays; | |
import java.util.UUID; | |
// create keyspace test with replication = {'class': 'SimpleStrategy', 'replication_factor': 1}; | |
// create table t2 (id uuid primary key, value list<text>); | |
public class CassandraTest { | |
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
# uncomment for a colored prompt, if the terminal has the capability; turned | |
# off by default to not distract the user: the focus in a terminal window | |
# should be on the output of commands, not on the prompt | |
force_color_prompt=yes | |
# Add git branch if its present to PS1 | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
if [ "$color_prompt" = yes ]; then |
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
val top = new TopK() | |
for ( i <- 1 to 10 ) top.insert(i) | |
for (i <- 10 to 0 by -1) top.insert(i) |
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
class TopK { | |
private val K = 10 | |
private val values = new Array[Long](K) | |
private var size = 0 | |
def insert(item: Long) = { | |
if (size < K) { | |
values(size) = item |
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
// Source: https://groups.google.com/forum/#!topic/angular/hVrkvaHGOfc | |
// jsFiddle: http://jsfiddle.net/pkozlowski_opensource/PxdSP/14/ | |
// author: Pawel Kozlowski | |
var myApp = angular.module('myApp', []); | |
//service style, probably the simplest one | |
myApp.service('helloWorldFromService', function() { | |
this.sayHello = function() { | |
return "Hello, World!" |
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
WeakHashMap<Integer, String> map = new WeakHashMap<Integer, String>(); | |
map.put(new Integer(10), "aaa"); // remove entry | |
// map.put(10, "aaa"); // don't remove entry | |
// map.put(Integer.valueOf(10), "aaa"); // don't remove entry | |
for (int i = 0; i < Integer.MAX_VALUE; i++) { | |
if (map.size() != 0) { | |
System.out.println("At iteration " + i + " the map still holds the reference to object"); | |
} else { |
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
1. “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” | |
- C.A.R. Hoare (British computer scientist, winner of the 1980 Turing Award) | |
2. “If debugging is the process of removing software bugs, then programming must be the process of putting them in.” | |
- Edsger Dijkstra (Dutch computer scientist, winner of the 1972 Turing Award) | |
3. “Measuring programming progress by lines of code is like measuring aircraft building progress by weight.” | |
- Bill Gates (co-founder of Microsoft) | |
4. “Nine people can’t make a baby in a month.” (regarding the addition of more programmers to get a project completed faster) |