Skip to content

Instantly share code, notes, and snippets.

View snsinfu's full-sized avatar
🕺
📆🍩🍩🍩📲

snsinfu snsinfu

🕺
📆🍩🍩🍩📲
View GitHub Profile
@snsinfu
snsinfu / typeindex_without_rtti.cc
Created January 11, 2017 06:11
type_index without RTTI
/*
* type_index without RTTI
*
* Copyright frickiericker 2016.
* Distributed under the Boost Software License, Version 1.0.
*
* Permission is hereby granted, free of charge, to any person or organization
* obtaining a copy of the software and accompanying documentation covered by
* this license (the "Software") to use, reproduce, display, distribute,
* execute, and transmit the Software, and to prepare derivative works of the
@snsinfu
snsinfu / mergesort.rkt
Created February 1, 2017 07:24
[Exercise] Merge sort in Racket, using match extensively
#lang racket
(define (split xs)
(match xs
['() (list '() '())]
[(list _) (list xs '())]
[(list a b rem ...) (match (split rem)
[(list as bs) (list (cons a as) (cons b bs))])]))
(define (merge xs ys)
@snsinfu
snsinfu / qdo
Last active February 13, 2017 22:55
Wrapper script of qsub for running a command synchronously on a compute node.
#!/bin/sh -efu
usage() {
cat >&2 << END
usage: $(basename "$0") [-NWalqvVXIh] command...
Execute command on a compute node as an interactive job.
Note: Due to the design of qsub, the standard error stream of the job is
merged to the standard output stream.
@snsinfu
snsinfu / zshrc
Created February 14, 2017 06:48
ZSH fuzzy completion
# http://superuser.com/a/815317
#
# 0 -- vanilla completion (abc => abc)
# 1 -- smart case completion (abc => Abc)
# 2 -- word flex completion (abc => A-big-Car)
# 3 -- full flex completion (abc => ABraCadabra)
#
# See:
# - matcher-list in zshcompsys(1)
# - COMPLETION MATCHING CONTROL in zshcompwid(1)
cmake -DOPENMM_BUILD_OPENCL_LIB=OFF \
-DOPENMM_BUILD_PYTHON_WRAPPERS=OFF \
-DOPENMM_BUILD_EXAMPLES=OFF \
-DOPENMM_BUILD_DRUDE_PLUGIN=OFF \
-DOPENMM_BUILD_RPMD_PLUGIN=OFF \
-DOPENMM_BUILD_AMOEBA_PLUGIN=OFF \
-DOPENMM_BUILD_PME_PLUGIN=OFF \
-DOPENMM_BUILD_CUDA_COMPILER_PLUGIN=OFF \
-DOPENMM_BUILD_REFERENCE_TESTS=ON \
-DCMAKE_BUILD_TYPE=Release \
@snsinfu
snsinfu / qsummary.sh
Created March 29, 2017 08:56
Succinctly display information on running PBS jobs.
#!/bin/sh -efu
#
# Succinctly display information on running PBS jobs.
#
# Usage:
# % install qsummary.sh ~/bin/
# % watch qsummary.sh
# % watch qsummary.sh username
#
LANG=C
[user]
useConfigOnly = true
[alias]
ci = commit
co = checkout
lg = log --graph --abbrev-commit --decorate --date=format:'%b %e %R' --format=format:'%C(cyan)%h%C(reset) %C(blue)%ad%C(reset) %C(black)%cn%C(reset) - %s' --all
set autoindent
set autoread
set backspace=indent,eol,start
set backupdir=.,~/.vim/backup
set complete-=i
set directory=~/.vim/swap//
set display=lastline
set formatoptions=tcqj
set history=10000
set hlsearch
# Mouse
set-option -g mouse on
bind-key -n WheelUpPane \
if -Ft= '#{?mouse_any_flag,1,}#{?pane_in_mode,1,}' \
'send-keys -M' \
'select-pane -t=; copy-mode -e'
@snsinfu
snsinfu / c.vim
Created May 25, 2017 02:03
Highlight function names in C source code
" Place this file in ~/.vim/after/syntax directory.
syn match cOpenParen "?=(" contains=cParen,cCppParen
syn match cFunc "\w\+\s*(\@=" contains=cOpenParen
hi def link cFunc Function