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 | |
semaphore() { | |
if [ -e $0.pid ]; then | |
PID=$(cat $0.pid) | |
fi | |
if [ $PID ]; then | |
echo $PID on file | |
PIDr=$( ps -ef | awk '{print $2}' | grep ^$PID$ ) |
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 | |
semaphore() { | |
if [ -e $0.pid ]; then | |
PID=$(cat $0.pid) | |
fi | |
if [ $PID ]; then | |
echo $PID on file | |
PIDr=$( ps -ef | awk '{print $2}' | grep ^$PID$ ) |
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 | |
use Getopt::Long; | |
use strict; | |
my $src = $ENV{'PWD'}; | |
my $dst = "/cygdrive/c/pictures/export/digital"; | |
my $quality = 75; | |
sub usage { |
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
;; first, remove all the crap that looks different from emacs 20.7.1 | |
; luddite mode | |
(cond ((> emacs-major-version 20) | |
(tool-bar-mode -1) ; introduced in emacs 21 | |
(menu-bar-mode -1) | |
(scroll-bar-mode -1) | |
(menu-bar-showhide-fringe-menu-customize-disable) | |
(blink-cursor-mode -1) | |
(windmove-default-keybindings 'meta))) |
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
(defun lisp-enable-paredit-hook () (paredit-mode 1)) | |
(add-hook 'clojure-mode-hook 'lisp-enable-paredit-hook) | |
(defmacro defclojureface (name color desc &optional others) | |
`(defface ,name '((((class color)) (:foreground ,color ,@others))) ,desc :group 'faces)) | |
(defclojureface clojure-parens "DimGrey" "Clojure parens") | |
(defclojureface clojure-braces "#49b2c7" "Clojure braces") | |
(defclojureface clojure-brackets "SteelBlue" "Clojure brackets") | |
(defclojureface clojure-keyword "khaki" "Clojure keywords") |
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
;; runs the current buffer in the environment where the file resides. | |
(defvar extention-to-executer-bindings ()) | |
(add-to-list 'extention-to-executer-bindings '("pl" . "perl")) | |
(add-to-list 'extention-to-executer-bindings '("php" . "php -f")) | |
(add-to-list 'extention-to-executer-bindings '("sh" . "bash")) | |
(defun lookup-executer (ext) | |
"find appropriate executer for script" | |
(interactive) |
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
sub pirnt {print @_} | |
pirnt "hello world\n" |
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]))) |