Skip to content

Instantly share code, notes, and snippets.

View chluehr's full-sized avatar

Christoph Lühr chluehr

View GitHub Profile
@chluehr
chluehr / switch_twinview.sh
Created January 27, 2011 08:55
Gnome Panel Conf. Switcher
#!/bin/bash
# from: https://answers.launchpad.net/ubuntu/+source/gnome-panel/+question/8152
# Cristian Măgherușan-Stanciu
if [[ "x$1" == "xon" ]]
then
echo "Turning on VGA"
xrandr --output VGA --left-of LVDS --auto
echo "Moving panel to second display"
gconftool-2 --set "/apps/panel/toplevels/top_panel_screen0/monitor" --type integer "1"
@chluehr
chluehr / lighttpd_sample.conf
Created February 8, 2011 12:28
A space to keep notes about lighttpd (lighty) config options
# only for 1.4.24 and above!
#
server.modules += ( "mod_rewrite" )
url.rewrite-if-not-file = (
"^/events/(.*)/$" => "/events/$1/index.php"
)
# other solution: mod_magnet
server.modules += ( "mod_magnet" )
magnet.attract-physical-path-to = ( "/etc/lighttpd/rewrite.lua" )
@chluehr
chluehr / solr_range_unset.txt
Created March 23, 2011 18:01
Solr filter query to find all documents where a field value is EITHER IN a given range OR not set at all.
fq:-(-age:[18 TO 60] AND age:[* TO *])
@chluehr
chluehr / youtube_unlisted.php
Created May 4, 2011 16:19
Set video as "unlisted" via Zend for YouTube
// set video to unlisted
$accessControlElement = new Zend_Gdata_App_Extension_Element(
'yt:accessControl', 'yt', 'http://gdata.youtube.com/schemas/2007', ''
);
$accessControlElement->extensionAttributes = array(
array(
'namespaceUri' => '',
'name' => 'action',
'value' => 'list'
@chluehr
chluehr / oauth.php
Created June 23, 2011 13:52 — forked from tjlytle/oauth.php
Command Line Script to get Access Token using Zend_Twitter
#!/usr/bin/php
<?php
require_once 'Zend/Oauth/Consumer.php';
require_once 'Zend/Console/Getopt.php';
//set valid config file types/extensions
$configTypes = array('ini', 'xml', 'json', 'yaml');
//setup command line opts
$opts = new Zend_Console_Getopt(array(
@chluehr
chluehr / ipinfodb-jquery.html
Created July 14, 2011 09:20
Query ipinfodb via jquery / JSONP
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>
$.getJSON("http://api.ipinfodb.com/v3/ip-country/?key=API_KEY_HERE&format=json&callback=?",
function(data){
alert(data['countryCode']); //DE,AT ...
});
</script>
</head>
@chluehr
chluehr / varnishpurge.sh
Created July 27, 2011 10:52
Purge varinsh cache by shell / url pattern
varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082 purge.url "^/asset/Look-.*-ski-thumb.jpg$"
@chluehr
chluehr / gist:1126168
Created August 4, 2011 20:28
Notes on SSD usage
# Example /etc/fstab
# / was on /dev/sda1 during installation
UUID=73d37f98-4668-4686-985b-6574087e62e8 / ext4 noatime,discard,errors=remount-ro,user_xattr 0 1
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
=====================================================
Firefox: about:config - add/set key:
browser.cache.disk.parent_directory
@chluehr
chluehr / test_mtu.sh
Created October 18, 2011 08:03
MTU Ping test
#!/bin/bash
# test MTU of 1500:
ping -M do -s 1472 127.0.0.1
# check MTU to a destination along a path:
tracepath 127.0.0.1
@chluehr
chluehr / phar_notes.txt
Created October 20, 2011 14:30
PHP phar notes
# add to / update php.ini:
suhosin.executor.include.whitelist=phar
[Phar]
phar.readonly = Off
# sample phing buildfile:
<?xml version="1.0" encoding="UTF-8"?>