Skip to content

Instantly share code, notes, and snippets.

@tarruda
tarruda / pkg-gonfig.go
Created November 29, 2015 21:48 — forked from mattn/pkg-gonfig.go
go implementation of pkg-config
package main
import (
"io/ioutil"
"os"
"path/filepath"
"regexp"
"strings"
)
@tarruda
tarruda / lxc-autostart.tcl
Last active December 14, 2015 10:23
Autostart unprivileged lxc containers
#!/usr/bin/expect
# Workaround to automatically start unprivileged containers on boot. This is
# required because unprivileged containers only seem to work when started from
# an interactive login session. Reference: https://github.com/lxc/lxc/issues/411#issuecomment-71414916)
#
# This script can be called from the user crontab with the @reboot
# directive(runs once at startup). One way to achieve this is to save this
# script to /home/USER/lxc-autostart.tcl and add the following entry to
# `crontab -e`:
@tarruda
tarruda / nvim-terminal-edit.py
Last active September 4, 2020 05:32
Edit file in host Neovim instance from a :terminal buffer
#!/usr/bin/env python
"""Edit a file in the host nvim instance."""
import os
import sys
from neovim import attach
args = sys.argv[1:]
if not args:
print "Usage: {} <filename> ...".format(sys.argv[0])
@tarruda
tarruda / gtk3-pyenv.sh
Created January 9, 2015 06:38
Install pygtk3 in pyenv
#!/bin/bash
# script for pyenv installation of pygtk3 in ubuntu 12.04
# Adapted from https://gist.github.com/mehcode/6172694
system_package_installed() {
if ! dpkg -l | grep -q $1; then
sudo apt-get install $1
fi
}
@tarruda
tarruda / twilight.vim
Created December 13, 2014 19:05
twilight vim theme
hi Normal term=NONE cterm=NONE ctermbg=234 ctermfg=230 gui=NONE guibg=#1a1a1a guifg=#fffedc
hi PreProc term=underline cterm=NONE ctermbg=234 ctermfg=145 gui=NONE guibg=#1a1a1a guifg=#8a9597
hi Type term=underline cterm=NONE ctermbg=234 ctermfg=144 gui=NONE guibg=#1a1a1a guifg=#a2a96f
hi Underlined term=underline cterm=underline ctermbg=234 ctermfg=230 gui=underline guibg=#1a1a1a guifg=#fffedc
hi Ignore term=NONE cterm=NONE ctermbg=bg ctermfg=234 gui=NONE guibg=bg guifg=#1a1a1a
hi Error term=reverse cterm=NONE ctermbg=95 ctermfg=231 gui=NONE guibg=#602020 guifg=#ffffff
hi Todo term=NONE cterm=bold ctermbg=234 ctermfg=145 gui=bold,italic guibg=#1a1a1a guifg=#8a9597
hi String term=NONE cterm=NONE ctermbg=234 ctermfg=80 gui=NONE guibg=#1a1a1a guifg=#4bb5c6
hi SpecialKey term=bold cterm=NONE ctermbg=234 ctermfg=236 gui=NONE guibg=#1a1a1a guifg=#303030
hi NonText term=bold cterm=bold ctermbg=234 ctermfg=102 gui=bold guibg=#1a1a1a guifg=#605958
@tarruda
tarruda / tui.c
Last active August 29, 2015 14:10
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <termkey.h>
#include <tickit.h>
@tarruda
tarruda / tmux.terminfo
Last active November 16, 2015 11:07
tmux terminfo for italics
# Custom terminfo for better using tmux with urxvt, 256colors and italics
# Compile/install with `tic tmux.terminfo`, then set $TERM to "tmux"
# (it requires a program that uses `tgetent` to obtain terminal
# information)
tmux|tmux with rxvt-unicode-256color client,
use=rxvt-unicode-256color,
use=screen,
@tarruda
tarruda / keybase.md
Created September 16, 2014 10:01
keybase.md

Keybase proof

I hereby claim:

  • I am tarruda on github.
  • I am tarruda (https://keybase.io/tarruda) on keybase.
  • I have a public key whose fingerprint is 5A71 6962 941B 684F 539E 6CD0 BEC2 61F3 78B2 8824

To claim this, I am signing this object:

@tarruda
tarruda / nvim_persistence_service.py
Created September 15, 2014 12:23
Nvim persistence service
import sqlite3, msgpack
class NvimPersistenceService(object):
def __init__(self, vim):
self.connection = sqlite3.connect('.nvim-persisted.db')
with self.connection as c:
c.execute('''
CREATE TABLE IF NOT EXISTS nvim
(
key TEXT PRIMARY KEY,
@tarruda
tarruda / snake.py
Last active June 11, 2021 00:01
snake.py
# Snake for Neovim! Adapted from https://gist.github.com/sanchitgangwar/2158084
# To install, create a ~/.vim/rplugin/python/snake.py file with this
# code, then run `nvim -c 'UpdateRemotePlugins' -c 'q'` from a shell.
#
# Make sure you have read the internal help explaining how to setup python
# host for external plugins(:help nvim-python)
#
# To start a new game, use the `:SnakeStart` command on an empty buffer(uses 80
# columns and 20 rows)
from threading import Thread, Lock