Skip to content

Instantly share code, notes, and snippets.

" File: commonjs-package-json
" Author: Ash Berlin <[email protected]>, Grigory V. <[email protected]>
" Last Change: 8-May-2011.
" Version: 2.0
" Usage:
"
" Use by placing something like the following in your .vimrc:
"
" let g:maintainer='{ "name": "Ash Berlin", "web": "http://ashberlin.com" }'
"
@valpackett
valpackett / bench.clj
Created July 10, 2011 18:52
OpenCL vs Clojure, CPU vs GPU Fibonacci benchmark
(use 'calx)
(def benchn 40)
(def ocl-src "int fib(int a) {
int b = -1;
int c = 1;
int d;
int i;
for (i=0;i<=a;i++) {
d = c + b;
@valpackett
valpackett / dijkstra.clj
Created August 27, 2011 16:28
Dijkstra's algorithm in Clojure
; http://www.algolist.com/Dijkstra's_algorithm
(defn dijkstra [g src]
(loop [dsts (assoc (zipmap (keys g) (repeat nil)) src 0)
curr src
unvi (apply hash-set (keys g))]
(if (empty? unvi)
dsts
(let [unvi (disj unvi curr)
nextn (first (sort-by #(% dsts) unvi))
@valpackett
valpackett / LICENSE.md
Created November 10, 2011 17:48
Evernote-Marked integration
       DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
               Version 2, December 2004

Copyright (C) 2011 Grigory V. [email protected]

Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.

DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE

@valpackett
valpackett / dabblet.css
Created January 6, 2012 11:46
Interface shadows
/**
* Interface shadows
* like http://ilyabirman.ru/meanwhile/2012/01/06/1/
*/
.btn {
display: inline-block;
border: #C0C0C0 solid 1px;
border-radius: 6px;
padding: 10px 15px;
@valpackett
valpackett / 1_WTF.md
Created February 3, 2012 18:32
Kindle dictionary template

Kindle dictionary template

Use it with KindleGen

kindlegen dic.opf

document.oncopy = function() {
var sel = window.getSelection();
var $div = $('<div style="position:absolute;left:-99999px">').html((sel+"").replace('⃏', 'руб.')).appendTo('body');
sel.selectAllChildren($div[0]);
setTimeout($div.detach, 0);
}
@valpackett
valpackett / ohlife_to_evernote.py
Created July 19, 2012 13:28
OhLife to Evernote importer
# works only on Mac OS X with Evernote desktop client installed
# download the ohlife plaintext export and pipe it to this script
# eg. $ cat ~/Downloads/ohlife_2012blablabla.txt | python ohlife_to_evernote.py
# don't forget to change the notebook title if it's not "Journal"
from pipes import quote
import sys
import os
buf = ''
@valpackett
valpackett / dabblet.css
Created August 4, 2012 19:26
Four column layout
/**
* Four column layout
*/
body { padding: 0; margin: 0; }
div {
background: linear-gradient(#ea0, #c60);
color: white;
font: 7em Helvetica;
@valpackett
valpackett / README.md
Created August 18, 2012 14:16
MODX + Monolog

MODX Revolution + Monolog

Replace MODX logging with Monolog to log to Graylog2, syslog, AMQP, etc.

Installation

  • put all the contents of this gist into the document root (where folders core, manager, etc. are located)
  • run composer install to get Monolog
  • run sh patchmodx.sh
  • edit modx-monolog.php - at line 22 there's the default handler - replace it with whatever you want to log to - see monolog readme for more info