Skip to content

Instantly share code, notes, and snippets.

View hoffoo's full-sized avatar

Marin hoffoo

  • UserVoice
  • Oakland, CA
View GitHub Profile
package pass
import (
"io"
"os"
"unicode"
)
type DB struct {
filename string
@hoffoo
hoffoo / toggle_touchpad.sh
Created April 25, 2014 19:36
toggle touchpad xinput
#!/bin/sh
XINPUT_ENABLE_PROP=140
DEV=$(xinput list | grep TouchPad | cut -d= -f2 | cut -f1 | xargs)
XINPUT_TOGGLE_CMD="xinput set-prop $DEV $XINPUT_ENABLE_PROP"
XINPUT_STATUS=$(xinput list-props $DEV | grep $XINPUT_ENABLE_PROP | cut -d: -f2)
if [ $XINPUT_STATUS -eq "1" ]
then
XINPUT_TOGGLE=0
@hoffoo
hoffoo / udpate_bundles.sh
Created April 28, 2014 20:21
update fugitive bundles
for r in *; do cd $r; git pull origin master; cd ..; done
#include <dlfcn.h>
#include <stdio.h>
int main()
{
if (!dlopen("libdbdpgsql.so", RTLD_NOW)) {
printf("couldnt open!\n");
} else {
printf("success!!!!!!\n");
}
" vim beakpoint format to clipboard
func! CopyAsClip()
let s:pos=expand('%:p') . ':' . line('.')
call system("xclip", s:pos)
endfunc
#!/bin/bash
# update pathogen .vim/bundle repositories
BACK=$(pwd)
update() {
cd $1
if [ -d ".git" ]; then
#!/bin/bash
# random words generator
dict="/usr/share/dict/american-english"
let word_c="$(wc -l $dict | awk '{print $1}')"
p=p
let oldseed=$(date +%N)
typedef char* itch_msg; // message content only
typedef void (*itch_handler)(itch_msg); // message handler func type
typedef itch_handler itch_map[122]; // map of message name and func ptr
// emit looks up the data in itch_map and calls appropriate function
void itch_emit(itch_map* m, char* data);
// Handlers
#define MSG_SYSTEM_EVENT 'S'
local array = {1,2,0,0,3,1,2}
function swap(a, b, table)
if table[a] == nil or table[b] == nil then
return false
end
if table[a] > table[b] then
table[a], table[b] = table[b], table[a]
package main
// our first concern is to keep a good state of all the objects in the ui
// to do it quickly we need to control how objects are inserted, moved, and resized
type Monitor struct {
size_x int
size_y int
widgets []Widget
}