Skip to content

Instantly share code, notes, and snippets.

@nikolaplejic
nikolaplejic / core.clj
Created September 2, 2010 17:54
File upload example in Compojure
(ns fileupload.core
(:use [net.cgrand.enlive-html
:only [deftemplate defsnippet content clone-for
nth-of-type first-child do-> set-attr sniptest at emit*]]
[compojure.core]
[ring.adapter.jetty])
(:require (compojure [route :as route])
(ring.util [response :as response])
(ring.middleware [multipart-params :as mp])
(clojure.contrib [duck-streams :as ds]))
#rec
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1600x900 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.mkv
###convert
mencoder -oac mp3lame -lameopts cbr=128 -ovc xvid -xvidencopts bitrate=1200 aula3.mkv -o aula3_mencoder.avi
#MERGE
mkvmerge -o complete.mkv part1.mkv +part2.mkv +part3.mkv +part4.mkv
#conv ffmpeg
@daveray
daveray / gist:1138754
Created August 11, 2011 01:59
Seesaw File Chooser
(use 'seesaw.core)
(use 'seesaw.chooser)
(def open-action
(action :name "Open" :key "menu O"
:handler
(fn [e]
(if-let [f (choose-file)]
(text! (select (to-root e) [:#my-text]) f)))))
@rodneyrehm
rodneyrehm / watermark.imagick.php
Created August 22, 2011 09:01
Watermark with IMagick
<?php
// Watermark with Imagick
// load images
$image = new Imagick("image.jpg");
$watermark = new Imagick("watermark.png");
// translate named gravity to pixel position
$position = gravity2coordinates($image, $watermark, 'lowerRight', 5, 5);
// compose watermark onto image
@daveray
daveray / seesaw-repl-tutorial.clj
Created December 7, 2011 04:55
Seesaw REPL Tutorial
; A REPL-based, annotated Seesaw tutorial
; Please visit https://github.com/daveray/seesaw for more info
;
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers
; Seesaw's basic features and philosophy, but only scratches the surface
; of what's available. It only assumes knowledge of Clojure. No Swing or
; Java experience is needed.
;
; This material was first presented in a talk at @CraftsmanGuild in
; Ann Arbor, MI.
@SethRobertson
SethRobertson / index.md
Created December 30, 2011 18:22
Commit Often, Perfect Later, Publish Once: Git Best Practices
@noahlz
noahlz / joy-of-clojure-lazy-qsort.clj
Created January 11, 2012 03:37
Lazy QuickSort implementation in Clojure, from Joy of Clojure chapter 6.
(ns joy.q)
;; nil
(defn nom [n] (take n (repeatedly #(rand-int n))))
;; #'joy.q/nom
(defn sort-parts [work]
(lazy-seq
(loop [[part & parts] work] ;; Pull apart work - note: work will be a list of lists.
(if-let [[pivot & xs] (seq part)] ;; This blows up unless work was a list of lists.
@anoopengineer
anoopengineer / linux_commands
Created March 6, 2012 12:47
Useful but uncommon Linux Commands
Recursively deleting all backup files that CVS creates (CVS creates backup files like .#Filename.java.1.1):
find ./ -name \.\*|xargs rm -f
Recursively changing ownership of CVS checkout
find ./ -name Tag | xargs sed -i -e "s/old_username/new_username/"
Recursively removing tabs from source files:
find . -name *.java -exec sed -ie 's/<Ctrl V and then a TAB>/ /g' {} \;
@scttnlsn
scttnlsn / README.md
Created July 30, 2012 22:16
Pub/sub with MongoDB and Node.js

Pub/sub with MongoDB and Node.js

Setup:

$ mongo
> use pubsub
> db.createCollection('messages', { capped: true, size: 100000 })
> db.messages.insert({})
@francisbyrne
francisbyrne / chmodr.sh
Created September 16, 2012 07:54
Recursive chmod script for dirs and/or files
#!/bin/sh
#
# chmodr.sh
#
# author: Francis Byrne
# date: 2011/02/12
#
# Generic Script for recursively setting permissions for directories and files
# to defined or default permissions using chmod.
#