Skip to content

Instantly share code, notes, and snippets.

@pluskid
pluskid / .tmux.conf
Last active May 23, 2021 22:00
tmux configuration
set-option -g prefix C-l
bind-key Space last-window
# Avoid Esc key delay when using VIM
set -sg escape-time 0
set-option -g history-limit 1000000
# See here for instructions to install tpm
@pluskid
pluskid / init.vim
Last active October 16, 2023 20:52
~/.config/nvim/init.vim
"================================================================================
" Setups
" 1. Install vim-plug
" 2. Run `:PlugInstall` in NeoVim
"================================================================================:
"================================================================================
" Install Plugins
"================================================================================
" Specify a directory for plugins
@pluskid
pluskid / tex-shortcut.vim
Last active August 29, 2015 14:21
UltiSnips shortcuts for typing TeX symbols
" shortcuts for TeX symbols
autocmd FileType tex inoremap <buffer> <silent> __ __<C-R>=UltiSnips#Anon('_\{${1:${VISUAL}}\}',
\ '__', '', 'i')<cr>
autocmd FileType tex inoremap <buffer> <silent> ^^ ^^<C-R>=UltiSnips#Anon('^\{${1:${VISUAL}}\}',
\ '^^', '', 'i')<cr>
autocmd FileType tex inoremap <buffer> <silent> (( ((<C-R>=UltiSnips#Anon('\left(${1:${VISUAL}}\right)',
\ '((', '', 'i')<cr>
autocmd FileType tex inoremap <buffer> <silent> `a `a<C-R>=UltiSnips#Anon('\alpha',
@pluskid
pluskid / report-template.tex
Last active May 26, 2023 00:40
A LaTeX template that I use for writing notes and reports.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Use the koma-script document style
\documentclass{scrbook}
\KOMAoptions{twoside=false} % disable two-side formatting for scrbook
% alternatively, for shorter essay, use the following
% \documentclass{scrartcl}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Useful packages
@pluskid
pluskid / sample-resume.tex
Last active January 7, 2022 01:08
Sample resume template
% Some people asked the LaTeX template for http://pluskid.org/assets/chiyuan-resume.pdf
% So I put a sample here. Feel free to use / modify it. Note you need to use xelatex to
% compile it and change the fonts to the ones you prefer and have on your system.
\documentclass[11pt]{article}
\usepackage{color}
\definecolor{ColorURL}{rgb}{0.1,0.12,0.45}
\usepackage[colorlinks=true,urlcolor=ColorURL]{hyperref}
\usepackage{fontspec,xunicode,xltxtra}
\usepackage[left=.8in,right=.8in,top=.9in,bottom=.7in]{geometry}
\usepackage{setspace}
" vim: set foldmarker={,} foldlevel=0 foldmethod=marker:
"=======================================
" Initialization {
"=======================================
set nocompatible
call pathogen#infect()
filetype plugin indent on
"}
@pluskid
pluskid / sparse_to_dense.py
Created June 7, 2012 07:49
Convert Sparse Feature to Dense Feature
import sys
class Data:
def __init__(self, line):
data = line.split()
self.label = data[0]
self.feats = dict()
for i in range(len(data)-1):
a,b = data[i+1].split(':')
self.feats[int(a)] = b
@pluskid
pluskid / Assetfile
Created June 7, 2012 04:37
rules for rake-pipeline of my blog
# vim: filetype=ruby
output "compiled/files"
class AsyFilter < Rake::Pipeline::Filter
attr_accessor :config
def initialize
@output_name_generator = proc { |fn, wrap|
@config = {'ext' => 'png', 'opt' => ''}
@pluskid
pluskid / .vimrc
Created May 9, 2012 12:36
my vimrc
" vim: set foldmarker={,} foldlevel=0 foldmethod=marker:
"========================================
" Basic setting {
"========================================
set nocompatible
set visualbell " disable sound bell
let mapleader = ','
filetype plugin indent on " auto filetype identification
@pluskid
pluskid / gist:2496958
Created April 26, 2012 07:00
Efficient ref-counting prototype for SGVector
template <typename T>
class SGVector
{
public:
SGVector(int32_t len)
{
int32_t size = sizeof(T)*len + sizeof(int32_t);
uchar *memory = malloc(size);
m_buffer = memory + sizeof(int32_t);