Skip to content

Instantly share code, notes, and snippets.

View erszcz's full-sized avatar

Radek Szymczyszyn erszcz

View GitHub Profile
@michaelt
michaelt / latex.template
Created June 9, 2011 21:23
Simple Pandoc default.latex with comments
%!TEX TS-program = xelatex
\documentclass[12pt]{scrartcl}
% The declaration of the document class:
% The second line here, i.e.
% \documentclass[12pt]{scrartcl}
% is a standard LaTeX document class declaration:
% we say what kind of document we are making in curly brackets,
% and specify any options in square brackets.
@jbpotonnier
jbpotonnier / GroupBy.hs
Created October 24, 2011 21:38
groupBy in Erlang and Haskell
module GroupBy where
import Data.Map (Map)
import qualified Data.Map as Map
groupBy :: Ord b => (a -> b) -> [a] -> Map b [a]
groupBy f = foldr (\ v -> Map.insertWith (++) (f v) [v]) Map.empty
groupBy' :: Ord b => (a -> b) -> [a] -> Map b [a]
@josevalim
josevalim / 0_README.markdown
Created January 9, 2012 13:07
Hello world of Sinatra-like libraries on Elixir, Ruby and Node.js
@eThikas
eThikas / tcpick-mac-install.sh
Created February 27, 2012 00:55
Get TCPICK working on mac
#!/bin/bash
mkdir temp
cd temp
wget http://downloads.sourceforge.net/project/tcpick/tcpick/0.2.1/tcpick-0.2.1.tar.gz
tar zxvf tcpick-0.2.1.tar.gz
cd tcpick-0.2.1
CFLAGS="-m32" ./configure
echo "char *lookup();" >> src/lookup.h
make
sudo make install
@schmurfy
schmurfy / gist:3199254
Created July 29, 2012 14:33
Install pandoc Mac OS X 10.8
# Install MacTex: http://mirror.ctan.org/systems/mac/mactex/mactex-basic.pkg
$ sudo chown -R `whoami` /usr/local/texlive
$ tlmgr update --self
$ tlmgr install ucs
$ tlmgr install etoolbox
# Install pandoc view homebrew
@tristanbes
tristanbes / example.sh
Created November 9, 2012 15:53
Install Graphite on Debian Server
# Installing graphite dependencies
apt-get install -y python2.6 python-pip python-cairo python-django python-django-tagging
apt-get install -y libapache2-mod-wsgi python-twisted python-memcache python-pysqlite2 python-simplejson
pip install whisper
pip install carbon
pip install graphite-web
# Setup a vhost by grabbing the example the graphite team released on their repo.
# In this file, you'll provide the url used to access to your Graphite dashboard
wget https://raw.github.com/tmm1/graphite/master/examples/example-graphite-vhost.conf -O /etc/apache2/sites-available/graphite
@matze
matze / Makefile
Created December 3, 2012 11:45
Pandoc template
TEMPLATE = template.tex
STYLESHEET = style.css
MD = $(wildcard *.md)
TEX = $(patsubst %.md,%.tex,$(MD))
HTML = $(patsubst %.md,%.html,$(MD))
PDF = $(patsubst %.md,%.pdf,$(MD))
.PHONY: clean pdf html
all: pdf html
@lefant
lefant / pretty_config.erl
Last active June 22, 2020 08:49
a little escript snippet to pretty print erlang config, using the erl_syntax module
#!/usr/bin/env escript
%% -*- erlang -*-
%% * slurp in terms using inlined version of kernels file:consult/1
%% * convert to abstract syntax tree
%% * annotate all tuples
%% * pretty print using a hook to prefix the annotated nodes with newline
main([]) ->
io:format("%% -*-erlang-*-~n"),
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active May 8, 2024 05:28
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

@jfarcand
jfarcand / ngrep_hack.md
Last active May 29, 2018 18:07
Fixing broken ngrep with OS X Mavericks

Migrating to OS X Mavericks breaks the ngrep utility. Doing:

sudo ngrep -d lo0 -q -W byline port 8080

stopped working where the process exits immediately. I didn't dig into the ngrep code, but was able to find a simple workaround by doing

sudo ngrep -q -W byline -d lo0 '' 'port 8080'

You can call that a lazy hack, but it work!