Skip to content

Instantly share code, notes, and snippets.

View ganwell's full-sized avatar
💭
Gluing elephants to the ceiling

Jean-Louis Fuchs ganwell

💭
Gluing elephants to the ceiling
View GitHub Profile
http://ls10-www.cs.uni-dortmund.de/~menge/vimquick.pdf
@ganwell
ganwell / gist:1754954
Created February 6, 2012 21:18
Quick Look to TIFF
CFUrl url = CFUrl.FromUrlString("file:///Users/ganwell/Desktop/Untitled.png", null);
CGImage img = QuickLook.ThumbnailImageCreate(url, new SizeF(256, 256), new NSDictionary());
NSImage nsimg = new NSImage(img, new SizeF(256, 256));
NSObject obj = Runtime.GetNSObject
(MonoMac.ObjCRuntime.Messaging.IntPtr_objc_msgSend (nsimg.Handle, Selector.GetHandle("TIFFRepresentation")));
NSData data = obj as NSData; //-> null.
@ganwell
ganwell / gist:1755521
Created February 6, 2012 22:35
Add tracing output
using System;
using Mono.Cecil;
using Mono.Cecil.Cil;
using System.Reflection;
namespace ch.fangorn.LUI.AddTrace
{
class MainClass
{
public static bool verbose = false;
@ganwell
ganwell / .vimrc.vim
Created August 6, 2012 10:28
My vim config
call pathogen#infect()
syntax on
filetype plugin on
set tw=80
set autoindent
set noeb vb t_vb=
set guifont=Menlo\ Regular:h13
set number
@ganwell
ganwell / profile.sh
Last active October 8, 2015 03:48
Bash history of unique commands
# 5000 unique bash history lines that are shared between
# sessions on every command. Happy ctrl-r!!
shopt -s histappend
# Well the python code only does 5000 lines
export HISTSIZE=10000
export HISTFILESIZE=10000
export PROMPT_COMMAND="history -a; unique_history.py; history -r; $PROMPT_COMMAND"
@ganwell
ganwell / as diff
Created August 6, 2012 12:00
Build MacVim.app wtih python3 support using homebrew
diff --git a/Library/Formula/macvim.rb b/Library/Formula/macvim.rb
index 080d67c..cd6cce9 100644
--- a/Library/Formula/macvim.rb
+++ b/Library/Formula/macvim.rb
@@ -22,8 +22,8 @@ class Macvim < Formula
def install
# MacVim's Xcode project gets confused by $CC, so remove it
- ENV['CC'] = nil
- ENV['CFLAGS'] = nil
@ganwell
ganwell / rmux.bash
Created September 4, 2012 11:57
Connect to remote host and take your tmux.conf and vimrc to the host
#!/bin/bash
# Connect to remote host and take your tmux.conf and vimrc to the host
#
# Connect:
# rmux $HOST
# Run tmux:
# tmux ...
# Run vim:
# vi ...
@ganwell
ganwell / .tmux.conf
Created September 4, 2012 12:27
tmux.conf fast pane rearrange
bind-key C-v select-layout 72af,238x64,0,0{119x64,0,0[119x32,0,0,119x31,0,33],118x64,120,0}
bind-key v select-layout even-vertical
bind-key b select-layout even-horizontal
@ganwell
ganwell / logspec.py
Created September 23, 2012 16:08
Pylab spectogram with log. frequency scale
import numpy
import scipy
import matplotlib.pyplot as pyplot
def decibel(lin):
"""Convert amplitude to decibel.
We might later need power to decibel..."""
return 20*numpy.log10(norm(lin))
@ganwell
ganwell / renameSymbols.cs
Created September 23, 2012 16:48
Symbol renamer for .net / mono
/// I used Mono.Cecil 0.9.5
/// This code is proof of concept quality!
using System;
using Mono.Cecil;
using System.Collections.Generic;
using Mono.Cecil.Cil;
using System.IO;
using Mono.Collections.Generic;