Skip to content

Instantly share code, notes, and snippets.

View leomelzer's full-sized avatar

Leonhard Melzer leomelzer

View GitHub Profile
# Block Facebook
127.0.0.1 www.facebook.com
127.0.0.1 facebook.com
127.0.0.1 static.ak.fbcdn.net
127.0.0.1 www.static.ak.fbcdn.net
127.0.0.1 login.facebook.com
127.0.0.1 www.login.facebook.com
127.0.0.1 fbcdn.net
127.0.0.1 www.fbcdn.net
127.0.0.1 fbcdn.com
@edhedges
edhedges / gist:2995805
Created June 26, 2012 13:30
Sublime Text 2 - Useful Shortcuts (Mac OS X)

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@amercader
amercader / gist:4077761
Created November 15, 2012 09:57
RunKeeper export data to PostGIS script
#!/bin/bash
# RunKeeper data to PostGIS
# =========================
# 1. Download your RunKeeper data from http://runkeeper.com/exportDataForm
# 2. Extract the zip file and cd into the extracted folder
# 3. Run this script, adapting the config parameters to your setup
# Note: the database must be PostGIS enabled
#
# You may need to change the way psql is called depending on your Postgres
@leomelzer
leomelzer / tmux_local_install.sh
Last active November 24, 2015 14:32 — forked from sharjeelsayed/tmux_local_install.sh
bash script for installing tmux without root access.Updated to include latest Tmux version and some other minor changes
#!/bin/bash
# Source: https://gist.github.com/ryin/3106801
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.1
@danverbraganza
danverbraganza / hangman.py
Last active April 20, 2017 18:52
Hangman implemented in 3 lines of Python! For an explanation of how this works, see http://danverbraganza.com/writings/hangman-in-3-lines-of-python
license, chosen_word, guesses, scaffold, man, guesses_left = 'https://opensource.org/licenses/MIT', ''.join(filter(str.isalpha, __import__('random').choice(open('/usr/share/dict/words').readlines()).upper())), set(), '|======\n| |\n| {3} {0} {5}\n| {2}{1}{4}\n| {6} {7}\n| {8} {9}\n|', list('OT-\\-//\\||'), 10
while not all(letter in guesses for letter in chosen_word) and guesses_left: _, guesses_left = map(guesses.add, filter(str.isalpha, raw_input('%s(%s guesses left)\n%s\n%s:' % (','.join(sorted(guesses)), guesses_left, scaffold.format(*(man[:10-guesses_left] + [' '] * guesses_left)), ' '.join(letter if letter in guesses else '_' for letter in chosen_word))).upper())), max((10 - len(guesses - set(chosen_word))), 0)
print 'You', ['lose!\n' + scaffold.format(*man), 'win!'][bool(guesses_left)], '\nWord was', chosen_word
@samgiles
samgiles / postgistogeojson.js
Created April 4, 2012 07:38
A function that converts a PostGIS query into a GeoJSON object.
/*
* A function that converts a PostGIS query into a GeoJSON object.
* Copyright (C) 2012 Samuel Giles <sam@sam-giles.co.uk>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
@flootr
flootr / keyboards.md
Created June 7, 2018 08:33
short introduction to mechanical keyboards

Mechanical Keyboards

Why?

  • Customization
  • Sustainable
  • Fun!

Customization

@leomelzer
leomelzer / index.js
Created June 19, 2018 12:13
metatag-diff: Compare (diff) metatags of prod and stage host version given an article slug.
const fetch = require("node-fetch");
const cheerio = require("cheerio");
const diff = require("diff");
const colors = require("colors");
const inputSlug = process.argv[2];
const notImplemented = [
"[rel=amphtml]",
"[property='og:image']",
@jonathantneal
jonathantneal / parseCSS.js
Created July 10, 2012 22:24 — forked from anonymous/parseCSS.js
parseCSS.js // returns parsed CSS text as a JavaScript object
(function (global) {
function clean(css) {
return css
.replace(/\/\*[\W\w]*?\*\//g, "") // remove comments
.replace(/^\s+|\s+$/g, "") // remove trailing spaces
.replace(/\s*([:;{}])\s*/g, "$1") // remove trailing separator spaces
.replace(/\};+/g, "}") // remove unnecessary separators
.replace(/([^:;{}])}/g, "$1;}") // add trailing separators
}
@migurski
migurski / gray-scott.py
Created September 9, 2012 02:21
Adaptation of Nicolas P. Rougier’s Gray-Scott implementation with the Glumpy dependencies removed
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright INRIA
# Contributors: Nicolas P. Rougier (Nicolas.Rougier@inria.fr)
#
# DANA is a computing framework for the simulation of distributed,
# asynchronous, numerical and adaptive models.
#
# This software is governed by the CeCILL license under French law and abiding