This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file=$(basename "$1") | |
ext="${file##*.}" | |
file="${file%.*}" | |
declare -a vars=(120x120 114x114 80x80 72x72 58x58 57x57 50x50 29x29) | |
for v in ${vars[@]}; do | |
convert -resize $v $1 $file-$v.$ext | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psql -t -c "select key from media order by 1;" hikerpix > db.asc | |
s3cmd ls s3://{{your-bucket-path}} | sort > s3.asc | |
join -v 2 db.asc <(cut -c 55-74 s3.asc | sort -u) > orphans.asc | |
awk '{print $4}' s3.asc | grep -f orphans.asc > urls.asc | |
xargs -P 4 s3cmd del $1 < urls.asc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph G { | |
fontname = helvetica; | |
fontsize = 10; | |
node [fontname = helvetica; fontsize = 10; style = filled; fillcolor = grey]; | |
edge [fontname = helvetica; fontsize = 10]; | |
subgraph cluster0 { | |
label = "document"; | |
c0 [label = "children\n(inbound)"; fillcolor = green]; | |
h0 [label = "hierarchy"]; | |
n0 [label = "name"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph g { | |
fontname = helvetica; fontsize = 10; | |
node [shape = record; fontname = helvetica; fontsize = 10]; | |
edge [fontname = helvetica; fontsize = 10]; | |
/* Documents */ | |
doc0 [label = "<f0> parent_id|<f1> children|<f2> hierarchy|<f3> name|<f4> region"]; | |
doc1 [label = "<f0> parent_id|<f1> children|<f2> hierarchy|<f3> name|<f4> region"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import flask | |
import os | |
import psycopg2 | |
import psycopg2.pool | |
app = flask.Flask(__name__) | |
app.secret_key = '@1*V*vpVqqfyhCZ)s/`5>B^V]mJ85]We' | |
app.debug = True | |
pool = psycopg2.pool.SimpleConnectionPool( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ooh la la |
OlderNewer