Skip to content

Instantly share code, notes, and snippets.

View ap's full-sized avatar

Aristotle Pagaltzis ap

View GitHub Profile
@ap
ap / http-dav.conf
Created October 17, 2008 12:40
minimal Apache WebDAV configuration
# this is actually a collage of bits from various config files
LoadModule dav_module lib/httpd/modules/mod_dav.so
LoadModule dav_fs_module lib/httpd/modules/mod_dav_fs.so
DavLockDB "/var/db/httpd/davlock"
# the following BrowserMatch lines were part of the sample config from the Slackware Apache package
BrowserMatch "Microsoft Data Access Internet Publishing Provider" redirect-carefully
BrowserMatch "MS FrontPage" redirect-carefully
@ap
ap / gist:30399
Created November 30, 2008 07:03
usable git log output format
git log --pretty='format:%x1B[33m%H%Creset%n%Cgreen%ar%Creset %an <%ae>%n%x20 %x20 %x1B[1m%s%Creset%n'
git config --global format.pretty 'format:%x1B[33m%H%Creset%n%Cgreen%ar%Creset %an <%ae>%n%x20 %x20 %x1B[1m%s%Creset%n'
@ap
ap / userChrome.css
Created December 1, 2008 13:17
Use Unsorted folder icon for ★ folders in FF3
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
.bookmark-item[container="true"][label="★"] {
list-style-image: url('chrome://browser/skin/places/unsortedBookmarks.png') !important;
-moz-image-region: rect(0px 16px 16px 0px) !important;
}
@ap
ap / proxy.pac.js
Created December 14, 2008 14:20
Efficient ad blocking via proxy autoconfig
/* the network your computer is on, and the subnet mask of that network */
var local_network = '192.168.1.0';
var local_netmask = '255.255.255.0';
/* the host and port of your regular proxy, if any; otherwise an empty string */
var upstreamProxy = '';
/* space-separated list of hosts or domains that should always be connected to directly without using a proxy */
var directZones = 'plasmasturm.org delicious.com paulgraham.com yahoo.com';
@ap
ap / termtitle.sh
Created December 31, 2008 07:58
Set terminal title then run a command
#!/bin/bash
TITLE="$1"
shift
printf '\e]0;%s\007' "$TITLE"
"$@"
@ap
ap / gist:61242
Created February 10, 2009 04:57
Answers to Tom Duff's stylistic conundrums presented in “Reading Code From Top to Bottom”, http://www.iq0.com/notes/deep.nesting.html
/* answers to Tom Duff's stylistic conundrums presented in
[Reading Code From Top to Bottom]
(http://www.iq0.com/notes/deep.nesting.html)
*/
char *skip(char *s, int c) {
char cc;
for(;;) {
if(!*s) break;
cc = *s++;
@ap
ap / gist:66108
Created February 18, 2009 00:41
Polyglot Makefile (embedding a Perl script)
# polyglot Makefile (embedding a Perl script)
output.txt: input.txt Makefile
perl -x Makefile $< > $@
#!/usr/bin/perl
q-ignore:
-;
use strict;
# rest of Perl script;
@ap
ap / httpd-cgit.conf
Created March 31, 2009 12:22
cgit clean URLs Apache config
# cgit setup for Apache that results in completely clean URLs, ie.
# visiting http://git.example.org/ will produce the cgit index page
<VirtualHost *>
# this part is stand fare
ServerName git.example.org
DocumentRoot /var/www/htdocs/cgit/
<Directory "/var/www/htdocs/cgit/">
AllowOverride None
Options ExecCGI
Order allow,deny
@ap
ap / gist:94251
Created April 13, 2009 04:10
Broken dvipdft fix (failed trying to mkdir tempdir that it had already created)
--- /usr/share/texmf/bin/dvipdft 2007-06-28 04:50:14.000000000 +0200
+++ dvipdft 2009-04-13 06:13:05.000000000 +0200
@@ -31,7 +31,14 @@
$progname --help
$progname --version"
-tmpdir=`mktemp -d ${TMP-/tmp}/$progname.XXXXXX`
+# before we create the tmpdir, set trap for cleanup
+trap 'rm -rf $tmpdir ; exit 1' 1 2 3 7 13 15
+trap 'rm -rf $tmpdir' 0
%s![^\x00-\xff]!\= '&#' . char2nr(submatch(0)) . ';' !g