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
public static void logObjectAsJSON(String tag, Object o) { | |
// In order for this to work you need the XStream library located at http://xstream.codehaus.org/ | |
XStream x = new XStream(new Sun14ReflectionProvider(new FieldDictionary(new ImmutableFieldKeySorter())), new JsonHierarchicalStreamDriver()); | |
Log.d(tag, x.toXML(o)); | |
} |
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
// We are going to post to this url. | |
HttpPost post = new HttpPost("http://example.com/login"); | |
// We are going to use the apache httpclient | |
HttpClient client = new DefaultHttpClient(); | |
// The request is going to have some parameters. | |
final HttpParams params = new BasicHttpParams(); | |
// Set the redirecting parameter in params to false. This will make sure we dont follow redirects like 302 and the result we get from the server later is the actual one and not some follow up resource. |
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
// Use in.pdf, extract pages 1-5, 10-19 and 26-end and output in out.pdf | |
pdftk in.pdf cat 1-5 10-19 26-end output out.pdf |
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
module Cantor ( | |
c, | |
cx, | |
cy, | |
d, | |
h, | |
c_umkehr, | |
findmax) | |
where |
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
# coding=utf-8 | |
# Django 1.4.1 settings for <project-name> project. | |
import os | |
PROJECT_DIR = os.path.abspath(os.path.join(os.path.dirname( __file__ ), '..')) | |
DATABASE = os.path.join(PROJECT_DIR, 'db', 'db.sqlite3') | |
DATABASES = { | |
'default': { |
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
[Desktop Entry] | |
Type=Application | |
Name=SumatraPDF | |
MimeType=application/pdf; | |
Exec=env WINEPREFIX="/home/jonas/.wine" wine start /ProgIDOpen SumatraPDF %f | |
NoDisplay=true | |
StartupNotify=true | |
Icon=518F_SumatraPDF.0 |
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
[Desktop Entry] | |
Type=Application | |
Name=PDF-XChange Viewer | |
MimeType=application/pdf; | |
Exec=env WINEPREFIX="/home/jonas/.wine" wine start /ProgIDOpen PDF-XChangeViewer.1 %f | |
NoDisplay=true | |
StartupNotify=true | |
Icon=C055_PDFXCview.0 |
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/env python3 | |
# -*- coding: utf-8 -*- | |
__author__ = 'Jonas Gröger' | |
import argparse | |
import urllib.request | |
from urllib.error import URLError | |
from time import strftime | |
import os |
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
# From http://stackoverflow.com/a/6575693/488265 | |
# By http://stackoverflow.com/users/577088/senderle | |
from itertools import chain | |
from collections import defaultdict | |
class Graph(object): | |
def __init__(self, edges, vertices=()): | |
edges = list(list(x) for x in edges) | |
self.edges = edges |
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
def getCheckedOutGitCommitHash() { | |
def gitFolder = "$projectDir/.git/" | |
def takeFromHash = 12 | |
/* | |
* '.git/HEAD' contains either | |
* in case of detached head: the currently checked out commit hash | |
* otherwise: a reference to a file containing the current commit hash | |
*/ | |
def head = new File(gitFolder + "HEAD").text.split(":") // .git/HEAD | |
def isCommit = head.length == 1 // e5a7c79edabbf7dd39888442df081b1c9d8e88fd |
OlderNewer