Skip to content

Instantly share code, notes, and snippets.

View dchest's full-sized avatar
☮️

Dmitry Chestnykh dchest

☮️
View GitHub Profile
@dchest
dchest / multitouch.rkt
Created November 28, 2010 11:59
Example of using multitouch on a Mac in Racket
#lang racket
; Ported from http://pb.lericson.se/p/FpbYhX/
(require ffi/unsafe
ffi/unsafe/atomic)
(define libmulti (ffi-lib "/System/Library/PrivateFrameworks/MultitouchSupport.framework/MultitouchSupport"))
(define CFArrayRef _pointer)
@dchest
dchest / multitouch.rkt
Created November 28, 2010 13:25
Apple's multitouch with demo (run using gracket)
#lang racket/gui
; Ported from http://pb.lericson.se/p/FpbYhX/
(require ffi/unsafe
ffi/unsafe/atomic)
(define libmulti (ffi-lib "/System/Library/PrivateFrameworks/MultitouchSupport.framework/MultitouchSupport"))
(define CFArrayRef _pointer)
@dchest
dchest / cryptopass.py
Created December 16, 2010 02:56
CryptoPass implementation in Python
# Cryptopass by dchest
# Based on:
# pbkdf2.py -- library to calculate keys from passwords
# Copyright (C) 2010 Tobias Ammann
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of
@dchest
dchest / fossil-add
Created January 16, 2011 13:51
fossil add doesn't ignore files specified in ignore-glob. This uses fossil-extra to add any extra files in repo to fossil (because extra uses ignore-glob).
#!/bin/sh
fossil extra | tr '\n' '\0' | xargs -0 -t fossil add
@dchest
dchest / gist:800407
Created January 28, 2011 15:37
Microsoft's Symbolic Plan
Microsoft's Symbolic Plan
=========================
(Redmond, Microsoft HQ. One year before Windows Vista release. Meeting.)
Marketing VC:
Our latest marketing research suggests that UNIX has a
competitive advantage: _symbolic links_.
@dchest
dchest / ecdsa.go
Created February 10, 2011 19:15
ECDSA implementation using Go's provided curves
package ecdsa
import (
"io"
"os"
"big"
"crypto/elliptic"
"sync"
)
@dchest
dchest / goswitch
Created April 8, 2011 18:00
Switch between two different installations of Go
#!/bin/sh
#
# Switch between two different installations of Go:
#
# source goswitch dev
# ^ makes GOROOT ~/Sources/go
#
# source goswitch prod
# ^ makes GOROOT ~/go
@dchest
dchest / docgo
Created April 13, 2011 02:31
docgo - Runs godoc with the current path and opens browser (on a Mac).
#!/bin/sh
#
# Runs godoc with the current path and opens browser (on a Mac).
#
godoc -http=":8888" -path="." 2> /dev/null &
pid=$!
trap 'kill $pid' INT
open "http://localhost:8888"
@dchest
dchest / gist:923033
Created April 16, 2011 10:29
Password reset scheme
//
// Example.
//
// Your application must have a strong secret key for password reset purposes.
This key will be used to generate and verify password reset tokens. (If you
already have a secret key, for example, for authcookie package, it's better
not to reuse it, just use a different one.)
secret := []byte("assume we have a long randomly generated secret key here")
@dchest
dchest / new
Created April 25, 2011 10:27
Part of my .gitconfig
[instaweb]
local = true
httpd = webrick
port = 4321
[gui]
fontdiff = -family Menlo -size 11 -weight normal -slant roman -underline 0 -overstrike 0
[alias]
st = status