Skip to content

Instantly share code, notes, and snippets.

import time
from smartcard.CardType import AnyCardType
from smartcard.CardRequest import CardRequest
from smartcard.util import toHexString
from smartcard.System import readers
print readers()
import webbrowser
cardtype = AnyCardType()
@arjan
arjan / gist:92f45c10c1511ac16f33
Created June 30, 2015 06:35
GET /api/goldenage/favorites
"cards": [
{
"author": 356,
"category": "card",
"hashtags": [
{
"category": "hashtag",
"id": 355,
"title": "#gianluca"
@arjan
arjan / controller.ex
Last active August 29, 2015 14:18
Twitter authorization controller
defmodule TestApp.TwitterController do
use Phoenix.Controller
# Routing configuration:
#
# scope "/twitter", TestApp do
# pipe_through :browser_session
# get "/:lang/authorize", TwitterController, :authorize
# get "/redirect", TwitterController, :authorize_return
import gtk
import webkit
view = webkit.WebView()
sw = gtk.ScrolledWindow()
sw.add(view)
win = gtk.Window(gtk.WINDOW_TOPLEVEL)
win.add(sw)
@arjan
arjan / dbtestresults.txt
Created October 8, 2014 19:27
Speedup results of replacing the Zotonic database driver in release 0.11.0
SERIAL TESTS
------------
Old Zotonic PGSQL implementation w/ custom pgsql_pool
11:38:26.495 [info] squery test result: 42667 queries in 15000 ms (select now())
11:38:41.495 [info] squery test result: 43696 queries in 15000 ms (select true)
11:38:56.495 [info] squery test result: 46251 queries in 15000 ms (select 'hello')
11:39:11.495 [info] squery test result: 28560 queries in 15000 ms (select count(*) from rsc)
-module(router).
-export([g/0]).
%% [{attribute,1,file,
%% {"/home/arjan/devel/zotonic/src/router.erl",1}},
%% {attribute,1,module,router},
%% {attribute,1,lager_records,[]},
%% {attribute,3,export,[{route,1}]},
%% {function,5,route,1,
@arjan
arjan / splash9patch
Created May 23, 2014 16:15
Quickly create a 9-patch image suitable as splash screen (Android)
#!/bin/bash
FILE="$1"
OUT=$(echo $FILE|sed -e 's/\./.9./')
$(identify -format "export WIDTH=%w" splash.png)
$(identify -format "export HEIGHT=%h" splash.png)
convert $FILE -bordercolor none -border 1 $OUT

Keybase proof

I hereby claim:

  • I am arjan on github.
  • I am arjan (https://keybase.io/arjan) on keybase.
  • I have a public key whose fingerprint is 4952 8675 9F55 E55A E0AB 5B23 8A01 3801 B7E5 61EA

To claim this, I am signing this object:

package nu.reckon.app.tasks;
import nu.reckon.api.Client;
import nu.reckon.api.v5.Photo;
import nu.reckon.app.PhotoCache;
import nu.reckon.app.ReckonApi;
import nu.reckon.app.ui.ActivityIndicator;
import android.os.AsyncTask;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
@arjan
arjan / genvcl.py
Last active December 20, 2015 17:59
Generate varnish if-then-else statement for hosting multiple Zotonic versions
#!/usr/bin/env python
from glob import glob
import re
def backend(path):
return path.split('/')[3].replace('-', '_').replace('.', '_')
def site(path):
return path.split('/')[7]