Skip to content

Instantly share code, notes, and snippets.

@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 / 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 = ''
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 / 1_WTF.md
Created February 3, 2012 18:32
Kindle dictionary template

Kindle dictionary template

Use it with KindleGen

kindlegen dic.opf

@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 / 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 / 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 / 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;
" 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 / README.md
Created March 17, 2011 19:09
Yandex.Anthroponym client

Yandex.Anthroponym is a web service which translates names from English to Russian and vice versa. This is a little script (designed for TextExpander, but works fine in a shell) which gets the current Mac OS X clipboard content, translates it and prints back the output.

So you have copied "Ray William Johnson", for example. Type the abbreviation you've defined in TextExpander and "Рей Вильям Джонсон" will be pasted.

If you don't have PyPy (you should, it's really fast), change the first line to "#!/usr/bin/env python". Don't forget to pip install requests. And, of course, to set snippet type to "Shell Script" when adding to TextExpander.