Skip to content

Instantly share code, notes, and snippets.

@eleclerc
eleclerc / zfish.filter.php
Created December 18, 2009 16:18
ZendFramework-ish filter for PHP_Beautifier
<?php
/**
* A ZendFramework-ish filter for PHP_Beautifier
*
* This file have to go in:
* /path/to/pear/php/Beautifier/Filter/
*
* Use it in conjunction with Pear() and NewLines() filters:
* php_beautifier --input "/path/to/your-file.php" --filter="Pear() zfish() NewLines(after=T_DOC_COMMENT)"
*
@scvalex
scvalex / xmonad.hs
Created February 10, 2011 16:27
My xmonad.hs
import XMonad
import qualified XMonad.StackSet as W
import qualified Data.Map as M
import Data.List (isPrefixOf, (\\), tails)
import Data.Maybe (isNothing, fromMaybe, isJust, catMaybes)
import System.IO
import System.Posix.Unistd
import System.Posix.Files
@doitian
doitian / xmonad.hs
Created June 10, 2011 16:24
xmonad.hs
{-# OPTIONS_GHC -fcontext-stack=32 #-}
import XMonad hiding ( (|||) )
import qualified XMonad.StackSet as W
import Control.OldException(catchDyn,try)
import Data.Char (toLower)
import Data.List (intercalate, intersperse, isSuffixOf, isPrefixOf)
import qualified Data.Map as M (fromList)
@adunstan
adunstan / viewtables.sql
Created September 1, 2011 19:11
See which tables are called in a view
CREATE OR REPLACE FUNCTION public.viewtables(viewname text)
RETURNS SETOF text
LANGUAGE plperl
AS $function$
my $viewname = shift;
my $rv = spi_exec_query("explain (format yaml, verbose) SELECT * FROM $viewname");
my $resp = $rv->{rows}[0]->{'QUERY PLAN'};
my %tbls;
while ($resp =~ /Relation Name: (".*")\n\s+Schema: (".*")\n/g)
{
# Based off of http://www.haskell.org/haskellwiki/Xmonad/Using_xmonad_in_Unity_2D
#
# /usr/share/xsessions/xmonad.desktop
[Desktop Entry]
Encoding=UTF-8
Name=XMonad
Comment=Lightweight tiling window manager
Exec=xmonad
Icon=xmonad.png
@chalmerj
chalmerj / gist:1492384
Created December 18, 2011 04:39
Init script for Graphite carbon-cache
#! /bin/sh
### BEGIN INIT INFO
# Provides: carbon-cache
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: carbon-cache init script
# Description: An init script for Graphite's carbon-cache daemon.
### END INIT INFO
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 26, 2024 12:21
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
# Bash completation for application
_my_application()
{
local cur prev opts job
COMPREPLY=()
job="${COMP_WORDS[0]}"
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
@asenchi
asenchi / logstash-mysql-query-parse.md
Created September 20, 2012 01:06 — forked from jordansissel/logstash-mysql-query-parse.md
parsing mysql's bullshit query log format with logstash

parsing mysql query logs with logstash

The problem is that some lines in the file are missing timestamps when they aren't continuations of any previous line. It's dumb, really.

The mysql query log is seriously bullshit format, but nothing logstash can't unscrew.

The main goal here is to show how we can fix the 'missing timestamp' problem.

% ruby bin/logstash agent -e '

@rroblak
rroblak / README.md
Last active October 26, 2023 03:22
git diff image files on the command line, with color

This is a simple way to spot check that the modified image in your git index is the image you actually want without having to leave the command line.

Example: http://i.imgur.com/RUenUcM.png

Instructions

  1. Install git, ImageMagick, and jp2a via your favorite package manager.
  2. Put img-ascii-diff somewhere (e.g. ~/bin/img-ascii-diff).
  3. Put attributes in ~/.config/git/attributes.
  4. Modify ~/.gitconfig and add the lines below, pointing to wherever you put img-ascii-diff.