Skip to content

Instantly share code, notes, and snippets.

View thomd's full-sized avatar

Thomas Dürr thomd

  • Hamburg, Germany
View GitHub Profile
#! /usr/bin/env python
""" Convert values between RGB hex codes and xterm-256 color codes.
Nice long listing of all 256 colors and their codes. Useful for
developing console color themes, or even script output schemes.
Resources:
* http://en.wikipedia.org/wiki/8-bit_color
* http://en.wikipedia.org/wiki/ANSI_escape_code
@thomd
thomd / xvfb
Created February 5, 2014 12:58 — forked from jterrace/xvfb
XVFB=/usr/bin/Xvfb
XVFBARGS=":1 -screen 0 1024x768x24 -ac +extension GLX +render -noreset"
PIDFILE=/var/run/xvfb.pid
case "$1" in
start)
echo -n "Starting virtual X frame buffer: Xvfb"
start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --background --exec $XVFB -- $XVFBARGS
echo "."
;;
stop)
@thomd
thomd / currency.sh
Last active August 29, 2015 13:56
get currency from google via CLI
#!/bin/bash
currency() {
echo $(curl -s "http://www.google.com/finance/converter?a=1&from=$1&to=EUR" | sed '/currency_converter_result/!d;s/<[^>]*>//g' | cut -d " " -f 4)
}
gbp=$(currency "GBP")
echo $gbp
@thomd
thomd / play-build.gradle
Created February 22, 2014 23:55
gradle scripts for play framework
apply plugin: 'java'
apply plugin: 'js'
buildscript{
repositories{
mavenLocal()
mavenCentral()
}
dependencies{
@thomd
thomd / Application.java
Last active August 29, 2015 13:57
put model into play (1.x framework) session
package controllers;
import play.*;
import play.mvc.*;
import java.util.*;
import models.*;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.DeserializationConfig;
\ProvidesFile{absender.lco}
\KOMAoptions{%
% fromemail=true, % Email wird im Briefkopf angezeigt
% fromphone=true, % Telefonnumer wird im Briefkopf angezeigt
% fromfax=true, % Faxnummer wird im Briefkopf angezeit
% fromurl=true, % URL wird im Briefkopf angezeigt
% fromlogo=true, % Logo wird im Briefkopf angezeigt
% subject=titled, % Druckt "Betrifft: " vor dem Betreff
locfield=wide, % Breite Absenderergänzung (location)
@thomd
thomd / watch.sh
Created August 13, 2014 18:34 — forked from mikesmullin/watch.sh
#!/usr/bin/env bash
# script: watch
# author: Mike Smullin <mike@smullindesign.com>
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage:
# watch <path> <cmd...>
#
#!/bin/bash
version=1.0.1
versionDate="2014-02-14"
function showHelp() {
echo "watchfile - monitor file(s)/command and perform action when changed
Possible ways of usage
----------------------------------------
@thomd
thomd / server.js
Created August 23, 2014 17:28
Serve local files via HTTP
// A simple static file server for development use.
var express = require('express'),
app = express();
app.use('/', express.static(__dirname));
app.listen('8000');
@thomd
thomd / index.html
Last active August 29, 2015 14:06
Responsive WebDesign - Elastic Video
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="./style.css">
<title>elastic video</title>
</head>
<body>