Skip to content

Instantly share code, notes, and snippets.

View sidequestboy's full-sized avatar

Jamie Macdonald sidequestboy

  • Canada
View GitHub Profile
@sidequestboy
sidequestboy / ctags_commands.md
Last active December 20, 2015 06:29
ctags command lines for different situations

Coding GTK+-2.0 in C

ctags -R --c-kinds=+pxf -f ~/code/.tags `pkg-config gtk+-2.0 --cflags | sed \
's/^-pthread //' | sed 's/-I//g'` ~/code

Explanation: -R - recurses

--c-kinds=+pxf - includes function prototypes, external declarations, function definitions

@sidequestboy
sidequestboy / .bashrc
Last active March 24, 2020 18:44
coloured PS1 with git branch, stash indicators
#
# ~/.bashrc
#
export PATH="/usr/lib/colorgcc/bin/:$PATH:/home/jamie/.gem/ruby/2.1.0/bin"
export CCACHE_PATH="/usr/bin"
export WORKON_HOME=$HOME/.virtualenvs
source /usr/bin/virtualenvwrapper_lazy.sh
VBOX_USB=usbfs
# If not running interactively, don't do anything
@sidequestboy
sidequestboy / remote_command.c
Created February 16, 2014 20:28
C program to send remote commands to TTY1 over ssh
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <string.h>
#include <unistd.h>
void print_help(char *prog_name) {
printf("Usage: %s [-n] DEVNAME COMMAND\n", prog_name);
@sidequestboy
sidequestboy / lz78.py
Last active August 29, 2015 13:56
Little script that takes user input, and on the fly prints the corresponding LZ78 codeword pairs
#!/usr/bin/env python3
"""
LZ78 toy, reads characters from stdin and encodes on the fly.
"""
from sys import stdout
"""import getch, or define my own"""
try:
from msvcrt import getch
@sidequestboy
sidequestboy / alphabetize.py
Created May 17, 2014 02:04
Finding Fixed Points of the Lexicographic ordering of the Phonetic English Alphabet
#!/usr/bin/python
from collections import OrderedDict
conventional_alphabet = list('abcdefghijklmnopqrstuvwxyz')
conventional_phonetic = ['a', 'bee', 'cee', 'dee', 'e', 'ef', 'gee', 'aitch',
'i', 'jay', 'kay', 'el', 'em', 'en', 'o', 'pee',
'cue', 'ar', 'es', 'tee', 'u', 'vee', 'doubleu', 'ex',
'wye', 'zed']
def lexi(letters):
@sidequestboy
sidequestboy / capslock-to-ctrl.service
Last active August 26, 2015 02:34
Map Capslock to Control for ttys, shift-capslock for capslock behaviour
[Unit]
Description=Map capslock to ctrl
[Service]
Type=oneshot
ExecStart=/usr/bin/loadkeys /etc/make_capslock_ctrl.kmap
ExecStop=/usr/bin/loadkeys us
RemainAfterExit=yes
[Install]