Skip to content

Instantly share code, notes, and snippets.

View mbrezu's full-sized avatar
🐢
Yes, but not right now.

Miron Brezuleanu mbrezu

🐢
Yes, but not right now.
View GitHub Profile
square x = x * x
@mbrezu
mbrezu / gist:182217
Created September 7, 2009 07:45
Clojure gist test
(defn hello [name] (str "Hello, " name))
@mbrezu
mbrezu / quasiquote.clj
Created November 5, 2009 06:58
quasiquote with unquote-splicing
(ns quasiquote
(:use clojure.test))
;; **************************************
;; Quasiquote from ClojureQL
;; http://gitorious.org/clojureql/clojureql/blobs/master/src/dk/bestinclass/clojureql/util.clj
;; modified to work with unquote-splicing
;; **************************************
@mbrezu
mbrezu / debug.clj
Created December 14, 2009 15:45 — forked from khinsen/debug.clj
;; Slightly enhanced version of Alex Osborne's debug-repl (http://gist.github.com/252421)
;; Typing () quits the debug REPL, making it possible to continue without terminating the
;; input stream by typing Ctrl-D.
;; Inspired by George Jahad's version: http://georgejahad.com/clojure/debug-repl.html
(ns debug
[:require clojure.main])
(defmacro local-bindings
# This script adds and removes .gitignore files to a Visual Studio
# project. It is useful when temporary versioning a project with Git.
# TODO: add command line handling so the user can specify -r or -a
# on the command line, along with the directory name to handle.
import sys
import os.path
import os
@mbrezu
mbrezu / .conkerorrc
Created September 3, 2010 07:58
Conkeror configuration
//require("new-tabs.js");
add_delicious_webjumps("mbrezu");
require("page-modes/google-search-results.js");
xkcd_add_title = true;
google_search_bind_number_shortcuts();
homepage = "about:blank";
define_webjump("imdb", "http://imdb.com/find?q=%s");
define_webjump("stackoverflow", "http://stackoverflow.com/search?q=%s");
define_webjump("youtube", "http://www.youtube.com/results?search_query=%s&search=Search");
@mbrezu
mbrezu / Configurare Masina Virtuala Windows pentru Ocaml
Created September 12, 2010 12:01
TODO list pentru configurat masina virtuala pentru dezvoltare ocaml
TODO list pentru configurat masina virtuala pentru dezvoltare ocaml
instalat Microsoft Visual Studio Express 2010
instalat diverse
7zip
clipx
total commander
instalat Cygwin (folosind switch.ch, pare sa mearga OK)
mc
m4
@mbrezu
mbrezu / SRTfix.py
Created January 1, 2011 16:43
A small script to fix SRT times.
# Tries to fix a srt file to match the sub time with the actual dialog time.
# Inputs:
# - the srt file
# - a list of (srt time, spoken dialog time) pairs that will be used
# to infer the parameters for the srt time adjustment
# Outputs:
# - the corrected srt file to standard output
# - the correction parameters to standard error
import sys
@mbrezu
mbrezu / mergesrt.py
Created January 1, 2011 21:41
Combine timings from one srt with text from another.
import sys
import re
import math
import os.path
class SrtEntry(object):
def __init__(self, number, startTime, endTime, text):
self.number = number
self.startTime = startTime
self.endTime = endTime
(let ((cache (make-hash-table :test 'equal)))
(defun encode-js-identifier (identifier)
"Given a string, produces to a valid JavaScript identifier by
following transformation heuristics case conversion. For example,
paren-script becomes parenScript, *some-global* becomes SOMEGLOBAL."
(setf identifier (string-downcase identifier))
(or (gethash identifier cache)
(setf (gethash identifier cache)
(let ((no-case-conversion nil)
(lowercase t)