Skip to content

Instantly share code, notes, and snippets.

@ericboehs
ericboehs / alias.sh
Last active August 29, 2015 14:04
Merging github pull requests by ID
# These two aliases will allow you to check out the BRANCH that a PR is
# associated with by PR ID (gcopr) and also merge a pull request by ID into
# master (gmpr).
#
# I use this in conjunction with the ghi gem to allow me to review and merge pull
# requests from the command line. To show open pull requests (I alias this to `prs`):
#
# ghi list | grep --color=auto '↑' --color=none
# Git checkout pull request by ID
@thorsummoner
thorsummoner / Default (Linux).sunblime-keymap
Last active March 16, 2017 16:25
Sublime text 3 Linux keymap to be more like my bloody Windows keymap.
[
{ "keys": ["ctrl+q"], "command": "toggle_comment", "args": { "block": false } },
{ "keys": ["ctrl+shift+q"], "command": "toggle_comment", "args": { "block": true } },
{ "keys": ["ctrl+shift+w"], "command": "close" },
{ "keys": ["ctrl+space"], "command": "auto_complete" },
{ "keys": ["ctrl+space"], "command": "replace_completion_with_auto_complete", "context":
[
{ "key": "last_command", "operator": "equal", "operand": "insert_best_completion" },
{ "key": "auto_complete_visible", "operator": "equal", "operand": false },
{ "key": "setting.tab_completion", "operator": "equal", "operand": true }
@Lytol
Lytol / IRSSI Cheat Sheet.md
Last active January 24, 2020 04:57
IRSSI Cheat Sheet

General

  • /quit – Quit IRSSI

Windows

  • option+# – Navigate to specified window
  • ctrl-n – Navigate to next window
  • ctrl-p – Navigate to previous window
@manuq
manuq / gist:5592235
Created May 16, 2013 14:44
Custom scrollable widget for a Gtk DrawingArea
import cairo
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GObject
import sys
def _surface_from_file(file_location, ctx):
@thatsdone
thatsdone / pdaemon-sample.py
Last active August 14, 2018 05:27
A python-daemon 'runner.DaemonRunner' class extension (v0.1) and a sample.
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#!/usr/bin/python
import sys
import time
import logging
from daemon import runner
#
# An example daemon main logic application class.
# Just keep writing timestamps to a log file periodically.
#
@joar
joar / mgunicorn.py
Last active June 18, 2018 02:22
Run GNU MediaGoblin via gunicorn
import logging.config
from mediagoblin.app import MediaGoblinApp
from beaker.middleware import SessionMiddleware
logging.config.fileConfig('paste_local.ini')
app = MediaGoblinApp('mediagoblin_local.ini')
app = SessionMiddleware(app, {
@SeanHayes
SeanHayes / fabfile.py
Last active September 27, 2020 20:10
Example Fabric fabfile.py. It's a hodgepodge of old scripts and probably isn't best practice (uWSGI ought to have an init script), but it should give you a practical idea of how to use Fabric. This fabfile relies heavily on custom settings from a Django project in order to be more DRY. Includes commands for setting up a fresh Ubuntu Server insta…
# -*- coding: utf-8 -*-
#Copyright (C) 2013 Seán Hayes
import my_project.settings as dj_settings
from fabric.api import local, run, sudo, env, prompt, settings, cd, parallel, execute
from fabric.contrib.files import exists
from fabric.decorators import hosts, roles, runs_once
import json
import logging
import os
@depp
depp / gtk.c
Created February 13, 2013 04:34
/* Copyright 2012 Dietrich Epp <depp@zdome.net> */
#if defined(__GNUC__) && \
((__GNUC__ == 4 && __GNUC_MINOR >= 6) || __GNUC__ > 4)
#define HAVE_DPUSH 1
#endif
#include "keycode/keycode.h"
#include "keycode/keytable.h"
#include "sg/audio_system.h"
#include "sg/clock.h"
@schlamar
schlamar / gist:4149031
Created November 26, 2012 16:11
pygtk + pyglet
#!/usr/bin/python
import sys
import time
import math
import gtk
import gobject
import pyglet
import pyglet.gl as gl
@pindia
pindia / gist:3836713
Created October 4, 2012 21:51
Python truth table calculator
from itertools import izip, product, tee
# Logic functions: take and return iterators of truth values
def AND(a, b):
for p, q in izip(a, b):
yield p and q
def OR(a, b):
for p, q in izip(a, b):