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
apply plugin: 'java' | |
task initProject () << { | |
if (hasProperty(initPlugins)) { | |
initPlugins.split(',').each { plug -> project.apply { plugin(plug.trim()) } } | |
} | |
project.sourceSets*.allSource.srcDirTrees.flatten().dir.each { dir -> | |
dir.mkdirs() | |
} |
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
if [ "$color_prompt" = yes ]; then | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1)\$ ' | |
else | |
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(__git_ps1)\$ ' | |
fi | |
unset color_prompt force_color_prompt | |
# some more ls aliases | |
alias ll='ls -l' | |
alias la='ls -A' |
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
[color] | |
ui = auto | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green | |
[color "diff"] | |
whitespace = red reverse | |
meta = yellow bold | |
frag = magenta bold |
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 KnnSimple { | |
var trainData: List[Array[Double]] = null | |
def train(trainData: List[Array[Double]]) { | |
this.trainData = trainData | |
} | |
def nearestNeighbour(k: Int, point: Array[Double]) : List[Array[Double]] = { | |
nearestNeighbour(k, point, (x, y) => Math.sqrt(x.zip(y).map(pair => (pair._1 - pair._2) * (pair._1 - pair._2)).sum)) |
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
# How to perform a release with git & maven following the git flow conventions | |
# ---------------------------------------------------------------------------- | |
# Finding the next version: you can see the next version by looking at the | |
# version element in "pom.xml" and lopping off "-SNAPSHOT". To illustrate, | |
# if the pom's version read "0.0.2-SNAPSHOT", the following instructions would | |
# perform the release for version "0.0.2" and increment the development version | |
# of each project to "0.0.3-SNAPSHOT". | |
# branch from develop to a new release branch | |
git checkout develop |
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
X x = map.get(key); | |
if (set == null) { | |
final X value = new X(); | |
x = map.putIfAbsent(key, value); | |
if (x == null) { | |
x = value; | |
} | |
} |
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.sun.management.HotSpotDiagnosticMXBean; | |
import java.lang.management.ManagementFactory; | |
import javax.management.MBeanServer; | |
public class HeapDumper { | |
// This is the name of the HotSpot Diagnostic MBean | |
private static final String HOTSPOT_BEAN_NAME = "com.sun.management:type=HotSpotDiagnostic"; | |
// field to store the hotspot diagnostic MBean |
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.io.PrintWriter; | |
public class MemoryStatistics { | |
private static final int MB = 1024 * 1024; | |
private static Runtime runtime = Runtime.getRuntime(); | |
public static long getUsedMemory() { | |
return (runtime.totalMemory() - runtime.freeMemory()) / MB; |
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
for i in `sudo docker images|grep \<none\>|awk '{print $3}'`;do sudo docker rmi $i;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
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d | |
# fetch all repos | |
find . -maxdepth 1 -type d -exec echo {} \; -exec git --git-dir={}/.git --work-tree=$PWD/{} fetch \; | |
# prune all repos | |
find . -maxdepth 1 -type d -exec echo {} \; -exec git --git-dir={}/.git --work-tree=$PWD/{} remote prune origin \; |
OlderNewer