Skip to content

Instantly share code, notes, and snippets.

View gammy's full-sized avatar

gammy gammy

  • Stockholm
View GitHub Profile
@gammy
gammy / SOMETHING.C
Created October 6, 2014 15:09
Something
#include <stdint.h>
#define DEBOUNCE_MS 50
#define JPIN_D1 6
#define JPIN_D2 7
#define DIN_BTN JPIN_D1
#define DOUT_LED JPIN_D2

Github Atoms

It is possible to subscribe to commit changes on github via atom feeds, but github appear to have hidden the feed link. You can however find it manually.

  1. Go to the repository and branch you want to subscribe to. For example, https://github.com/gammy/misc-scripts/commits/master or https://github.com/Handle/project/tree/branch
  2. Look at the source code (ie CTRL+u)
  3. Search for atom or alternatively something like application/atom. You should hopefully now have located the atom feed URL, which will include a long authorization token
  4. Copy the link into your favourite feed reader. I use rssn which can be installed in debian/ubuntu with the .deb available on the site. It's available in arch through the AUR
@gammy
gammy / foo
Last active August 29, 2015 14:04
# Here we declare a static class:
>>> class static_foo:
... item = 1
...
# And here we declare one which is to be instantiated. Once it is, the method __init__ is called automatically:
>>> class dynamic_foo:
... def __init__(self):
from swms.core.models import AttributeLogEntry
print("Going through AttributeLogEntry, please wait")
fields = {
'first_name' : u'First Potato',
'last_name' : u'Last Potato',
'street' : u'Cheese Street',
'email' : u'[email protected]',
'region' : u'Cheddar',
@gammy
gammy / raisefocus.c
Created June 3, 2014 06:54
Set window focus on desired window ID.
/* Set window focus on desired window ID.
gcc -Wall -lX11 raisefocus.c
*/
#include <X11/Xlib.h>
#include <stdio.h>
#include <stdlib.h>
#include <libgen.h>
// This routine is taken directly from wmctr:main.c
static int client_msg(Display *disp, Window win, char *msg, /* {{{ */
@gammy
gammy / wmctrl_excerpt.c
Created June 2, 2014 12:12
client_msg from wmctrl
// Upon an activation event, wmctrl calls client_msg like so:
// client_msg(disp, win, "_NET_ACTIVE_WINDOW",
// 0, 0, 0, 0, 0);
static int client_msg(Display *disp, Window win, char *msg, /* {{{ */
unsigned long data0, unsigned long data1,
unsigned long data2, unsigned long data3,
unsigned long data4) {
@gammy
gammy / gist:ba3eecd436a2adbb9b94
Last active August 29, 2015 14:02
pekwm 0.1.17 key rebind oddity
When binding an action to a key,
KeyPress = "Print" { Actions = "Exec importseq -d img/screenshots/" }
the keypress events appear to change, and the keybinding does not work:
--- Before binding 'Print' ---
KeyPress event, serial 39, synthetic NO, window 0x3400001,
root 0x9e, subw 0x0, time 7888275, (171,-14), root:(173,126),
state 0x2000, keycode 107 (keysym 0xff61, Print), same_screen YES,
@gammy
gammy / 0_reuse_code.js
Created May 9, 2014 07:25
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
PD Simulator Dev booting
Random seed: 3971743434
Mains frequency: 50Hz
Input changed
** set_mode ********************************
Waiting 200ms for transformer to settle
** tev_4 ***************************
Cycle 0 Pcycle 0 Wait 0 Gain[set last cycle] 0
Cycle 25 Pcycle 1 Wait 300 Gain[set last cycle] 0
/* Convert 1-bit GIMP .h file to GLCD-compatible bitmap .h-file.
In essence it does the same as Michael Margolis's glcdBitmap sketch,
however this program is written from scratch without looking at his code.
Author: Kristian Gunstone
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