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 | |
updatedb -l 0 -o ~/.m2db -U ~/.m2 | |
function hardlink { | |
for i in $( ls -1 *.jar ); do | |
link=$(locate -n 1 -d ~/.m2db --regexp "/$i\$") | |
if [ "$link" == "" ]; then | |
echo not linking $i | |
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
(ns sandbox.compress-jpg | |
(meta {:description "change compression level without losing the metadata of a jpg file" | |
:url "http://blog.carsoncheng.ca/2011/02/how-to-change-jpeg-compression-in.html"}) | |
(:require clojure.java.io) | |
(:import [javax.imageio IIOImage ImageIO] | |
[javax.imageio.plugins.jpeg JPEGImageWriteParam])) | |
(defn compress-jpg [inputFile outputFile compressionQuality] | |
(let [image-reader (.next (ImageIO/getImageReadersByFormatName "jpg")) | |
image-writer (.next (ImageIO/getImageWritersByFormatName "jpg"))] |
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 fibos [] | |
(map first (iterate (fn [[a b]] [b (+ a b)]) [0 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
;; http://github.com/briancarper/dotfiles/raw/master/.emacs | |
;; {} are not handled correctly by paredit in the repl, | |
;; but these lines fixes it | |
(defvar slime-override-map (make-keymap)) | |
(define-minor-mode slime-override-mode | |
"Fix SLIME REPL keybindings" | |
nil " SLIME-override" slime-override-map) | |
(define-key slime-override-map (kbd "<C-return>") 'paredit-newline) | |
(define-key slime-override-map (kbd "{") 'paredit-open-curly) |
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
<?php | |
function test() { | |
global $data; | |
var_dump($data); | |
} | |
test(); | |
$data = array(1,2,3); | |
?> |
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 one-lineres) | |
;; 1. Multiple Each Item in a List by 2 | |
(map #(* 2 %) (range 1 11)) | |
;; 2. Sum a List of Numbers | |
(reduce + (range 1 1001)) | |
;; 3. Verify if Exists in a String | |
(def words #{"scala" "akka" "play framework" "sbt" "typesafe"}) |
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
<html> | |
<header> | |
<script type="text/javascript"> | |
function btnClick(aBtn) { | |
with (aBtn.form) { | |
event.value = aBtn.name; | |
submit(); | |
} | |
} | |
</script> |
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
export DROPBOX=~/Dropbox/repos | |
export newRepo=project-name | |
export NAME=$(git config --global --get user.name) | |
cd ~/projects/$newRepo | |
git init | |
git add . | |
git commit -m 'initial' | |
HERE=$(pwd) |
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/perl | |
@users = ( 'klang' ); | |
my $procs = qx/ps -ef/; | |
#my $login = qx/last/; | |
foreach my $user (@users) { | |
while ($procs =~ m/^ *(\w*).+ .:.. (.+)$/gm) { | |
my $usr = $1; | |
my $proc = $2; |