Skip to content

Instantly share code, notes, and snippets.

View LemonBoy's full-sized avatar

LemonBoy

View GitHub Profile
@LemonBoy
LemonBoy / gist:1109498
Created July 27, 2011 14:44
Custom Robo Arena Checksum Fixer
import sys, struct, zlib
print 'Checksum fixer for Custom Robot Arena (NDS)'
print 'The Lemon Man (c) 2011'
if len(sys.argv) < 2:
print 'Usage :\n\t%s <save name.sav>' % sys.argv[0]
sys.exit(1)
fil = open(sys.argv[1], 'r+b')
@LemonBoy
LemonBoy / gtkPaste.py
Created August 24, 2011 23:29
A lightweight gtk-based clipboard uploader
"""
gtkPaste 0.1
The Lemon Man (C) 2011
"""
import gtk
import keybinder
import urllib
class GenericError (Exception):
@LemonBoy
LemonBoy / gist:1402153
Created November 28, 2011 21:27
CMOS fun for boring days
#include <stdio.h>
#include <sys/io.h>
int convert_bcd (unsigned char bcd) {
return (bcd >> 4) * 10 + (bcd & 0xF);
}
unsigned char cmos_read (int offset) {
outb(0x80 | (offset & 0x7F), 0x70);
return inb(0x71);
@LemonBoy
LemonBoy / g6.pl
Created February 18, 2014 16:36
Let's play with G6_GRAPH.BIN!
# Extract/import database entries from G6_GRAPH.BIN database
# The Lemon Man (C) 2014
use strict;
use warnings;
use File::Slurp;
use JSON qw(from_json to_json);
sub json_to_db ($) {
my $text = read_file shift;
@LemonBoy
LemonBoy / apprentice.vim
Last active August 29, 2015 14:17
Apprentice theme for vim-airline
let g:airline#themes#apprentice#palette = {}
let s:N1 = [ '#bcbcbc', '#5f5f87', 250, 60 ]
let s:N2 = [ '#1c1c1c', '#ff8700', 234, 65 ]
let s:N3 = [ '#262626', '#87875f', 235, 101 ]
let g:airline#themes#apprentice#palette.normal = airline#themes#generate_color_map(s:N1, s:N2, s:N3)
let g:airline#themes#apprentice#palette.normal.airline_warning = [ '#1c1c1c', '#ffffaf', 234, 1 ]
let s:I1 = [ '#1c1c1c', '#87af87', 234, 108 ]
@LemonBoy
LemonBoy / gist:4b61b5ccaba2001f4ad4
Last active August 29, 2015 14:18
Find the project root
let s:has_git = executable('git')
fun! s:find_root()
let cvs_dir = ['.git', '.hg', '.svn', '.bzr', '_darcs']
let dir = getcwd()
let depth = 10
if !exists('g:root_cache')
let g:root_cache = []
endif
// gcc grab.c -lxcb -lxcb-xfixes -lxcb-xinput -Wall -o grab
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <sys/select.h>
#include <sys/time.h>
#include <xcb/xcb.h>
#include <xcb/xinput.h>
#include <xcb/xfixes.h>
local utils = require("mp.utils")
function enableDpms(v)
if v then
arg = '+dpms'
else
arg = '-dpms'
end
utils.subprocess({ args = { 'xset', arg } })
end
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 2b07352..d723251 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -4237,27 +4237,6 @@ do_source(
save_sourcing_lnum = sourcing_lnum;
sourcing_lnum = 0;
-#ifdef FEAT_MBYTE
- cookie.conv.vc_type = CONV_NONE; /* no conversion */
@LemonBoy
LemonBoy / buf.vim
Last active September 29, 2017 08:40
func! Format(this, alt, _, what) abort
let flags = ' +'[a:what.changed]
\ . ' %'[a:what.bufnr == a:this]
\ . ' #'[a:what.bufnr == a:alt]
let name = empty(a:what.name) ?
\ '[No Name]' : fnamemodify(a:what.name, ':~:.')
return printf(" %2d %s %s", a:what.bufnr, flags, name)
endfunc
func! Sort(a, b) abort
return a:a.bufnr < a:b.bufnr