Skip to content

Instantly share code, notes, and snippets.

@graste
graste / check_patches.sh
Created October 20, 2010 18:57
incomplete and errorprone patch<->local modified files check...
#!/bin/bash
saveIFS="$IFS"
IFS=$'\n'
diff(){
awk 'BEGIN{RS=ORS=" "}
{NR==FNR?a[$0]++:a[$0]--}
END{for(k in a)if(a[k])print k}' <(echo -n "${!1}") <(echo -n "${!2}")
}
@graste
graste / image_resize.js
Created May 21, 2011 14:04 — forked from felixge/image_resize.js
On demand image resizing with node.js in
// Usage: http://localhost:8080/image.jpg/100x50
var http = require('http');
var spawn = require('child_process').spawn;
http.createServer(function(req, res) {
var params = req.url.split('/');
var convert = spawn('convert', [params[1], '-resize', params[2], '-']);
res.writeHead(200, {'Content-Type': 'image/jpeg'});
convert.stdout.pipe(res);
@graste
graste / gist:1081370
Created July 13, 2011 21:25
svn/git repository/branch information in prompt (part of .bashrc)
#
# SED regexp in parse_svn_repository_root should be different on non-german systems :-)
#
c_cyan=`tput setaf 6`
c_red=`tput setaf 1`
c_green=`tput setaf 2`
c_sgr0=`tput sgr0`
@graste
graste / pnginator.rb
Created August 6, 2012 21:56 — forked from gasman/pnginator.rb
pnginator: pack Javascript into a self-extracting PNG
#!/usr/bin/env ruby -w
# pnginator.rb: pack a .js file into a PNG image with an HTML payload;
# when saved with an .html extension and opened in a browser, the HTML extracts and executes
# the javascript.
# Usage: ruby pnginator.rb input.js output.png.html
# By Gasman <http://matt.west.co.tt/>
# from an original idea by Daeken: http://daeken.com/superpacking-js-demos
@graste
graste / API.md
Created August 22, 2012 19:23 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@graste
graste / index.html
Created February 25, 2013 19:54 — forked from anonymous/index.html
<form role="search" class="search-form" id="search-form" action="#" method="post">
<section class="search-terms">
<label for="search-term" class="search-term-label screen-reader-text">Search Terms</label>
<div>
<span class="search-term-wrap">
<input type="search" id="search-term" class="search-term">
</span>
<span class="search-term-button-wrap">
<input type="submit" value="Search" class="search-button">
@graste
graste / cryptojs-aes-test.html
Created March 19, 2013 22:08
CryptoJS AES Test
<html>
<head>
<title>CryptoJS AES Test</title>
</head>
<body>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/core-min.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/rollups/aes.js"></script>
<script src="http://crypto-js.googlecode.com/svn/tags/3.1.2/build/components/enc-base64-min.js"></script>
<p>Create new encrypted files via:</p>
<code>openssl enc -aes-256-cbc -in SOURCE.FILE -out ENCRYPTED.AES -pass pass:"Secret Passphrase" -e -base64</code>
@graste
graste / gist:5204294
Last active December 15, 2015 04:50
Export puppet run on guest system via .dot as .svg to host system

Use --graph as option for puppet in Vagrantfile:

Vagrant::Config.run do |config|
  config.vm.define :devbox do |devbox|
    ...
    devbox.vm.customize ["modifyvm", :id, "--name", "trololo-devbox"]
    ...
    devbox.vm.provision :shell, :inline => "apt-get update --fix-missing"
    ...
 devbox.vm.provision :puppet do |puppet|
@graste
graste / gist:5384426
Last active December 16, 2015 05:29
Opera loading performance switches

Some opera loading related configuration switches:

  • opera:config#Performance|WaitForStyles - default 5000 milliseconds
  • opera:config#Performance|WaitForWebFonts - default 5000 milliseconds
  • opera:config#UserPrefs|FirstUpdateDelay - default is 1 second imho

There are some more settings in the performance section of the opera:config page (reflow, throttle etc.).

The first update delay setting is reflected in the Opera advanced settings dialog: <ctrl-f12> -> Advanced -> Browsing -> Loading -> Redraw instantly|after N seconds|after loading

@graste
graste / gist:5752691
Last active December 18, 2015 08:19
Leaflet, WMS etc.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="content-language" content="en" />
<title>Potsdam-Mittelmark WMS-Beispiel (GIS)</title>
<link rel="stylesheet" href="http://leaflet.cloudmade.com/dist/leaflet.css" />
<!--[if lte IE 8]><link rel="stylesheet" href="http://leaflet.cloudmade.com/dist/leaflet.ie.css" /><![endif]-->
<script type="text/javascript" src="http://leaflet.cloudmade.com/dist/leaflet.js"></script>
<script type="text/javascript" src="http://maps.stamen.com/js/tile.stamen.js?v1.1.3"></script>