Skip to content

Instantly share code, notes, and snippets.

View LemonBoy's full-sized avatar

LemonBoy

View GitHub Profile
@LemonBoy
LemonBoy / unqar.py
Created November 17, 2018 18:07
Quick and dirty script to extract Quartus II .qar archives
# Quick and dirty script to extract Quartus II .qar archives
import os, sys, struct, zlib
buf = open(sys.argv[1], 'rb').read()
file_no = struct.unpack_from('<H', buf, 2)[0]
off = 4
for _ in range(file_no):
(len, unk, filename_len) = struct.unpack_from('<IHH', buf, off)
func! Format(_, what) abort
let flags = ' +'[a:what.changed]
\ . ' %'[a:what.bufnr == bufnr('')]
\ . ' #'[a:what.bufnr == bufnr('#')]
if empty(a:what.name)
let name = '[No Name]'
else
let name = fnamemodify(a:what.name, ':~:.')
endif
return printf(" %2d %s %s", a:what.bufnr, flags, name)
@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
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 */
local utils = require("mp.utils")
function enableDpms(v)
if v then
arg = '+dpms'
else
arg = '-dpms'
end
utils.subprocess({ args = { 'xset', arg } })
end
// 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>
@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
@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 / 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 / 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);