Skip to content

Instantly share code, notes, and snippets.

expires = datetime.utcnow() + timedelta(days=(25 * 365))
expires = expires.strftime("%a, %d %b %Y %H:%M:%S GMT")
file.seek(0)
k.set_contents_from_string(file.read(), headers={
'Content-Type': 'image/jpeg',
'Cache-Control': 'public',
'Expires': expires,
})
#!/usr/bin/perl -wT
# Upgrade a PostgreSQL cluster to a newer major version.
#
# (C) 2005-2009 Martin Pitt <mpitt@debian.org>
#
# 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 2 of the License, or
# (at your option) any later version.
ooh la la
def randstr(length):
return ''.join(chr(random.randint(0,255)) for i in range(length))
def hash_password(password, maxtime=0.5, datalength=64):
return scrypt.encrypt(randstr(datalength), password, maxtime=maxtime)
def verify_password(hashed_password, guessed_password, maxtime=0.5):
try:
scrypt.decrypt(hashed_password, guessed_password, maxtime)
return True
@irneh
irneh / gist:5568229
Last active December 17, 2015 06:49

1

2

One good sentence.

#lang racket
;#lang web-server/insta
;(get-uri (calc g-i (car rings) cogs) (calc g-i (car (cdr rings)) cogs))
(define rings (list 38 50))
(define cogs (list 23 21 19 17 16 15 14 13 12 11))
(define max-x (/ 55 11.0))
(define axis (list 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0))
(define nums->csv
; Quick miniKanren-like code
;
; written at the meeting of a Functional Programming Group
; (Toukyou/Shibuya, Apr 29, 2006), as a quick illustration of logic
; programming. The code is really quite trivial and unsophisticated:
; it was written without any preparation whatsoever. The present file
; adds comments and makes minor adjustments.
;
; $Id: sokuza-kanren.scm,v 1.1 2006/05/10 23:12:41 oleg Exp oleg $
This is what people get when they mail you “offensive” stuff.
They layman wouldn’t know what’s going on and most glaringly there’s no “TEK Systems” or “Allegis” anything in here.
Just in case you hadn’t seen this before.
BTW the expression I used that got me filtered is increasingly common:
http://goo.gl/lcOHvG
http://goo.gl/Hm9T6k
(ns guestbook.routes.home
(:use compojure.core)
(:use hiccup.core)
(require [me.raynes.conch :as conch]
[amazonica.aws.s3 :as s3]
[clojure.data.json :as json]
[noir.io :as io]
[clojurewerkz.cassaforte.query :as cql-query]
[clojurewerkz.cassaforte.client :as cql-client]))
(defn move-to-s3 [k f]
(s3/put-object :bucket-name s3-bucket
:key k
:file f)
(io/delete-file f))
(defn upload [userid file]
(let [img-uuid (uuid)
exts [".orig.jpg" ".0.jpg" ".1.jpg"]
dims [[nil nil] [595 296] [180 120]]