This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct tty_ldisc { | |
int magic; | |
char *name; | |
int num; | |
int flags; /* * The following routines are called from above. */ | |
int (*open)(struct tty_struct *); | |
void (*close)(struct tty_struct *); | |
void (*flush_buffer)(struct tty_struct *tty); | |
ssize_t (*chars_in_buffer)(struct tty_struct *tty); | |
ssize_t (*read)(struct tty_struct *tty, struct file *file, unsigned char *buf, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ref: https://linux.die.net/man/3/wordexp | |
#include <iostream> | |
#include <string> | |
#include <wordexp.h> | |
using namespace std; | |
std::string expandPath(const std::string &str) { | |
wordexp_t p; | |
char** w; | |
wordexp(str.c_str(), &p, 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# references: https://github.com/pyenv/pyenv/issues/333 | |
# get pyenv | |
git clone https://github.com/pyenv/pyenv.git ~/.pyenv | |
# configure pyenv | |
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> $PROFILE | |
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> $PROFILE | |
# install python |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install --no-index --find-links file://`pwd`/pip-pkgs -r requirement.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip download -r requirement.txt -d pip-packages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git config --global diff.tool vimdiff | |
git config --global difftool.prompt false | |
git config --global alias.vimdiff difftool | |
# Usage: git vimdiff | |
# git vimdiff --cached |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const path = require('path'); | |
const zlib = require('zlib'); | |
const winston = require('winston'); | |
const Koa = require('koa'); | |
const Router = require('koa-router'); | |
const koaLogger = require('winston-koa-logger'); | |
const convert = require('koa-convert'); | |
const compress = require('koa-compress'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from https://stackoverflow.com/questions/1128496/to-get-a-prompt-which-indicates-git-branch-in-zsh | |
# get the name of the branch we are on | |
git_prompt_info() { | |
git branch | awk '/^\*/ { print $2 }' | |
} | |
get_git_dirty() { | |
git diff --quiet || echo '*' | |
} | |
autoload -U colors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: http://stevelorek.com/how-to-shrink-a-git-repository.html | |
function discoveryLargeGitObject() { | |
IFS=$'\n'; | |
# list all objects including their size, sort by size, take top 10 | |
objects=`git verify-pack -v .git/objects/pack/pack-*.idx | grep -v chain | sort -k3nr | head` | |
echo "All sizes are in kB. The pack column is the size of the object, compressed, inside the pack file." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*xterm*font: 12x24 | |
*xterm*background: #101010 | |
*xterm*foreground: #d0d0d0 | |
*xterm*cursorColor: #d0d0d0 | |
*xterm*color0: #101010 | |
*xterm*color1: #960050 | |
*xterm*color2: #66aa11 | |
*xterm*color3: #c47f2c | |
*xterm*color4: #30309b | |
*xterm*color5: #7e40a5 |