Skip to content

Instantly share code, notes, and snippets.

View superjer's full-sized avatar
💭
Thinking about celery

Jer Wilson superjer

💭
Thinking about celery
View GitHub Profile
#include <stdio.h>
#include <memory.h>
#define MAX 1000 /* max input line length + 1 */
static char line0[MAX]; /* the 2nd to last line of input */
static char line1[MAX]; /* the last line of input */
static int mark0[MAX]; /* markings for line0 */
static int mark1[MAX]; /* markings for line1 */
@superjer
superjer / lego.py
Last active December 24, 2015 11:09
Lego buying
import sys
try:
N = int(sys.argv[1]) # number of characters, the only input!
assert N >= 1
except:
N = 16
print "Defaulting to", N, "characters."
print "You could also supply a different number as argument 1."
@superjer
superjer / easier-directory-navigation.sh
Last active December 14, 2015 09:59
Easier directory navigation for Bash. Add to your .bashrc file. You can usually get where you need to be by just hitting Ctrl-O a lot, and avoid typing lots of cd this and cd that. See comments below for more info.
# Ctrl-P: go to parent dir (same as cd ..)
bind -m vi-insert '"\C-P":"\C-E\C-Ucd ..\C-M"'
bind -m emacs '"\C-P":"\C-E\C-Ucd ..\C-M"'
# Ctrl-O or Ctrl-B: go back to previous directory you were in
bind -m vi-insert '"\C-O":"\C-E\C-Ubackd\C-M"'
bind -m emacs '"\C-O":"\C-E\C-Ubackd\C-M"'
bind -m vi-insert '"\C-B":"\C-E\C-Ubackd\C-M"'
bind -m emacs '"\C-B":"\C-E\C-Ubackd\C-M"'
@superjer
superjer / bash-git-branch.sh
Last active December 14, 2015 09:50
Bash prompt with Git branch name & colors. It won't have much effect unless your system has the bash completion rules for Git installed. Add this to the end of your .bashrc file in your Home folder on whatever server you are working on. For it to take effect, you will have to log in again, or just run your .bashrc file.
GITBRANCH=''
if [ -f /etc/bash_completion.d/git ]; then
. /etc/bash_completion.d/git
GITBRANCH='$(__git_ps1)';
fi
# You can change the colors to what you want, especially if you have a 256 color terminal.
# Here's a color chart: http://upload.wikimedia.org/wikipedia/en/1/15/Xterm_256color_chart.svg
# Change the numbers in this column |
# |
@superjer
superjer / .vimrc
Last active September 26, 2015 17:47
SuperJer's .vimrc
" .vimrc
syntax on " Use syntax hilighting
set nocompatible " Use Vim defaults, as opposed to Vi defaults
set bs=indent,eol,start " Allow backspacing over everything in insert mode
set viminfo='20,<5000 " Store ' filesworth of marks and < lines in each register in the .viminfo file
set history=5000 " Keep this many lines of command line history
set ruler " Show the cursor position all the time, bottom right corner of the screen
set nowrap " Do not wrap lines
set shiftwidth=2 " Number of spaces to use for each autoindent, by default