Skip to content

Instantly share code, notes, and snippets.

View DanielOaks's full-sized avatar

Daniel Oaks DanielOaks

View GitHub Profile
@DanielOaks
DanielOaks / UserscriptCompatability.js
Created October 27, 2012 01:26
Allows userscript files to work both as Greasemonkey scripts, and as BabelExt extensions
// Basically, dynamically selects between BabelExt and Greasemonkey methods,
// depending on what is avalaible at runtime
//
// Simply put this at the top of your userscript, and use BE_set/getValue
// exactly as you would BabelExt.storage.set/get
//
// However, there is also another argument passed to getValue, def, as in the
// default value if none can be retrieved (as in Greasemonkey's GM_getValue)
function BE_setValue(key, val, callback) {
@DanielOaks
DanielOaks / Python-formatstrings.tmLanguage.diff
Created January 15, 2013 16:44
Sublime Text 2 Python format string syntax highlighting, Python.tmLanguage diff
--- Python.tmLanguage
+++ Python-formatstrings.tmLanguage
@@ -1171,7 +1171,7 @@
<key>constant_placeholder</key>
<dict>
<key>match</key>
- <string>(?i:%(\([a-z_]+\))?#?0?\-?[ ]?\+?([0-9]*|\*)(\.([0-9]*|\*))?[hL]?[a-z%])</string>
+ <string>(?i:%(\([a-z_]+\))?#?0?\-?[ ]?\+?([0-9]*|\*)(\.([0-9]*|\*))?[hL]?[a-z%])|(?&lt;=[({{)+]|[^{])({[0-9a-zA-Z]*(\.[0-9a-zA-Z]*)?(\[([^\])]*)\])?(![rsa])?(:)?})(?=(}})+|[^}])</string>
<key>name</key>
<string>constant.other.placeholder.python</string>
@DanielOaks
DanielOaks / gist:4754185
Last active December 12, 2015 09:49
Bitbucket issue conversion, fix for new everything
#!usr/bin/env python2
# -*- coding: utf-8 -*-
## And this is the modified Bitbucket library I use. I have to bundle this, because the actual one is broken
# -*- coding: utf-8 -*-
# git+git://github.com/Sheeprider/Py-BitBucket.git
__all__ = ['Bitbucket', ]
@DanielOaks
DanielOaks / .tmux.conf
Last active December 13, 2015 21:19
My tmux config file, might be useful to some other people
# COLOURS
set -g default-terminal "screen-256color"
# Status bar can have utf-8~
set-option -g status-utf8 on
# Status bar has a dim gray background
set-option -g status-bg "#303030"
set-option -g status-fg "#f0f0f0"
@DanielOaks
DanielOaks / m_fuzz.c
Last active December 17, 2015 19:39
ircfuzz for Plexus3, mostly for fun
/************************************************************************
* IRC - Internet Relay Chat,
* Copyright (C) 2001 Hybrid Development Team
*
* 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 1, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
@DanielOaks
DanielOaks / particles.cpp
Last active December 18, 2015 02:48
OpenGL 2/3d particle test. First time doing anything in C/C++ for years, beware
// First (proper) try at OpenGL programming, and first bit of C-like stuff
// for years, besides a quick dabble in C# ; caveat emptor
//
// Daniel Oaks 2013, public domain etc
//
// g++ -Wall -L/usr/lib -lGL -lGLU -lglut --std=c++11 particles.cpp -o particles
#include <stdio.h>
#include <stdlib.h>
#include <random>
#include <functional>
@DanielOaks
DanielOaks / dashpipe.pl
Last active December 22, 2015 01:29
Like Ponypipe, but faster
#!/usr/bin/env perl
# Dashpipe -- Hopefully a kinda faster, less fully-featured ponypipe.
# Copyright (c) 2013, Daniel Oaks, under 2-clause BSD license.
# the base regex list is from Ponypipe:
# https://github.com/maandree/ponypipe
use strict ;
use utf8 ; # we like utf8
use constant { true => 1, false => 0 } ; # I think these make sense, syntactically
@DanielOaks
DanielOaks / unify_znc_logs.py
Last active January 1, 2016 02:49
unifies znc logs
#!/usr/bin/env python3
# ZNC log unifier
# assumes all the logs are in folder 'log'
# and all files are output to folder 'outlog'
# This basically changes all the logs like:
# log/danneh_rizon_#chan_20142304.log
# log/danneh_rizon_#chan_20142305.log
# log/danneh_rizon_#chan_20142306.log
# to:
@DanielOaks
DanielOaks / add_barcodes.py
Last active September 11, 2017 02:15
Adds barcodes to Reckon item IIF lists
#!/usr/bin/env python2
# Reckon IIF item list barcode adder
# written by Daniel Oaks <daniel@danieloaks.net>
# licensed under the BSD 2-clause license
# Caution: DO NOT USE IIF. IT CAN BORK YOUR SYSTEM EASILY.
# This basically reads through each item in your item IIF, to see if it has a barcode
# if it doesn't have a barcode and the item name contains a digit, it makes the barcode the same
@DanielOaks
DanielOaks / library_extension_adder.py
Created April 16, 2014 08:50
Adds the correct extension to a provided library path
# platform library extension adder for Python or something
import os
import sys
__PLATFORM_LIBRARY_EXTENSIONS = {
'windows': 'dll',
'darwin': 'dylib',
'linux': 'so',
}