Skip to content

Instantly share code, notes, and snippets.

View colortrans.py
#! /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
View 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 Aug 29, 2015
get currency from google via CLI
View currency.sh
#!/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 Feb 22, 2014
gradle scripts for play framework
View play-build.gradle
apply plugin: 'java'
apply plugin: 'js'
buildscript{
repositories{
mavenLocal()
mavenCentral()
}
dependencies{
@thomd
thomd / Application.java
Last active Aug 29, 2015
put model into play (1.x framework) session
View Application.java
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;
View absender.lco
\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)
View 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...>
#
View watchfile.sh
#!/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 Aug 23, 2014
Serve local files via HTTP
View server.js
// 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 Aug 29, 2015
Responsive WebDesign - Elastic Video
View index.html
<!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>