Skip to content

Instantly share code, notes, and snippets.

View i-e-b's full-sized avatar
🤔
Thinking

Iain Ballard i-e-b

🤔
Thinking
View GitHub Profile
@danielgomezrico
danielgomezrico / Function.java
Created May 9, 2015 16:05
Android - check if running on main thread
public boolean runningOnMainThread() {
return Looper.getMainLooper().getThread() == Thread.currentThread();
}
@jossef
jossef / colors.py
Last active February 2, 2023 20:39
python coloring for linux, based on this answer http://stackoverflow.com/a/26445590/3191896
def color(text, **user_styles):
styles = {
# styles
'reset': '\033[0m',
'bold': '\033[01m',
'disabled': '\033[02m',
'underline': '\033[04m',
'reverse': '\033[07m',
@smhanov
smhanov / dawg.py
Last active February 23, 2026 22:18
Use a DAWG as a map
#!/usr/bin/python3
# By Steve Hanov, 2011. Released to the public domain.
# Please see http://stevehanov.ca/blog/index.php?id=115 for the accompanying article.
#
# Based on Daciuk, Jan, et al. "Incremental construction of minimal acyclic finite-state automata."
# Computational linguistics 26.1 (2000): 3-16.
#
# Updated 2014 to use DAWG as a mapping; see
# Kowaltowski, T.; CL. Lucchesi (1993), "Applications of finite automata representing large vocabularies",
# Software-Practice and Experience 1993
@on-three
on-three / gist:9e40cbf33765dbd3ffbb
Last active October 11, 2022 14:09
VLC capture window by xwindows id (window capture and streaming WITH audio)
1: Get the audio output device you'll record off:
pacmd list-sources | awk '/name:.+\.monitor/'
name: <alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor>
name: <alsa_output.pci-0000_00_1b.0.analog-stereo.monitor>
2: Get the x windows id (linux) of the window you'll capture
xwininfo -name "Nestopia"
xwininfo: Window id: 0x3a00003 "Nestopia"
...
@i-e-b
i-e-b / .vimrc
Last active March 24, 2017 11:00
vim configuration files for Window
" THIS rc is for VsVim under Visual Studio on Windows
set virtualedit=onemore
set selectmode=
set number
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
set backspace=indent,eol,start
@MatthewSteeples
MatthewSteeples / gist:5588087
Created May 15, 2013 22:56
Code to rename namespaces from compiled assemblies using Mono.Cecil
using Mono.Cecil;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace CecilTest
@spikebrehm
spikebrehm / modifierKey.js
Created September 19, 2012 02:50
Determine if a modifier key is pressed in JavaScript.
// modifierKey used to check if cmd+click, shift+click, etc.
!function($, global){
var $doc = $(document);
var keys;
global.modifierKey = false;
global.keys = keys = {
'UP': 38,
'DOWN': 40,
@jshih
jshih / .vimrc
Created August 22, 2012 07:18
Enable Ctrl+c and Ctrl+v for copy and paste in gvim
vmap <C-c> "+yi
vmap <C-x> "+c
vmap <C-v> c<ESC>"+p
imap <C-v> <ESC>"+pa
@cab1729
cab1729 / ComplexFun.cs
Created July 20, 2012 19:08
C# Math trig functions using System.Numerics.Complex type
using System;
using System.Numerics;
namespace MathFun
{
/// <summary>
/// Trig functions for Complex numbers
/// </summary>
/// <remarks>
/// main reference: Schaum's Outlines: Complex Variables ISBN-13: 978-0070602304
@i-e-b
i-e-b / .gitignore
Last active October 7, 2015 01:18
A .Net / VisualStudio über ignore file
obj
bin
deploy
*.csproj.user
*.suo
*.cache
~$*
*~
*ReSharper*
*.swp