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
(reduce + | |
(map #(read-string (str %)) | |
(str (.pow (BigInteger. "2") 1000)))) |
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
disk-speed() { | |
tstfile=/tmp/tstfile.$RANDOM | |
print "Write speed: " $(dd if=/dev/zero bs=1024k of=$tstfile count=1024 2>&1 | awk '/sec/ {print $1 / $5 / 1048576, "MB/sec" }') | |
purge | |
print " Read speed: " $(dd if=$tstfile bs=1024k of=/dev/null count=1024 2>&1 | awk '/sec/ {print $1 / $5 / 1048576, "MB/sec" }') | |
rm $tstfile | |
} |
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
(defn diagonal [m] | |
(map #(nth (nth m %) %) | |
(take (count m) (iterate inc 0)))) |
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
# Change the regex group to your programming language's extensions | |
git ls-files | egrep '\.(h|cpp)$' | xargs cat | wc -l |
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
// The MIT License (MIT) | |
// | |
// Copyright (c) 2015 Nandor Kracser | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this software and associated documentation files (the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions: |
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
#!/usr/bin/bash | |
if [ $# != 2 ] | |
then | |
echo usage: findclass [CLASS] [DIR] | |
exit 1 | |
fi | |
jars=(`find $2 -name '*.jar'`) |
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
(ns json-bench.core | |
(:require [cheshire.core :as cheshire]) | |
(:require [clojure.data.json :as json]) | |
(:require [clj-json.core :as clj-json])) | |
(defn nano-time [] | |
(System/nanoTime)) | |
(defn timed [task] | |
(let [t-start (nano-time) |
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
#!/usr/bin/bash | |
if [ $# != 2 ] ; then | |
echo $0 [FILE] [LINENUMBER] | |
fi | |
{ rm $1 && awk '{ if (NR != DEL) print }' DEL=$2 > $1; } < $1 |
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.BufferedInputStream; | |
import java.io.FileInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.zip.GZIPInputStream; | |
public class GZipTest { | |
public static void main(String[] args) throws IOException { |
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
; Clojure step 1 | |
(defn is-prime? [n] | |
"Detects if input paramter is a prime." | |
(if (<= n 3) | |
true | |
(let [max (Math/floor (Math/sqrt n))] | |
(loop [d 2] | |
(if (zero? (rem n d)) | |
false |