Skip to content

Instantly share code, notes, and snippets.

Christopher Shroba chrisshroba

Block or report user

Report or block chrisshroba

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View .tmux.conf
# Make it so when you set the window title,
# it is never automatically changed by tmux
set-option -g allow-rename off
# This enables mouse reporting. It lets you:
# - Click on a pane to activate it
# - Right click a pane to `mark` it
# - Drag borders to resize panes
setw -g mouse on
set -g mouse on
View .tmux.conf
# Welcome to my tmux config!
# Some helpful notes to future me
# - bind is an alias of bind-key (no difference).
# - bind <key> binds the key after the prefix.
# - bind -r <key> binds the key in the root table,
# meaning no prefix is necessary.
# -
# Put Plugins first because they may define behavior
@chrisshroba
chrisshroba / regex
Last active Dec 16, 2016
A CLI for searching for a matching group and returning only that group (Rather than the entire matching line as grep does)
View regex
#!/usr/bin/env python
import re
from sys import argv
if len(argv)<3:
print("Usage:")
print("{} <string> <pattern>".format(argv[0]))
exit(2)
@chrisshroba
chrisshroba / one_line_flask_app.py
Last active Dec 15, 2016
A one liner flask app!
View one_line_flask_app.py
(lambda a:a.route('/')(lambda:'Hello')+a.run())(__import__('flask').Flask(''))
@chrisshroba
chrisshroba / nginx.conf
Created Oct 31, 2016
The nginx configuration for wiki.shroba.io
View nginx.conf
server {
listen 80;
server_name wiki.shroba.io w;
client_max_body_size 15M;
client_body_buffer_size 128k;
root /usr/share/nginx/www/wiki;
index doku.php;
View -
/* File: simp3.k */
requires "arithbool.k"
module SIMP3-SYNTAX
imports ARITHBOOL-SYNTAX
imports ARITHBOOL-SEMANTICS
/*
ARITHBOOL-SYNTAX introduces (variable free) arithmetic and boolean
@chrisshroba
chrisshroba / server.py
Created Sep 23, 2016
Dogfacts Slack Bot
View server.py
from flask import *
import random
import json
app = Flask(__name__)
@app.before_request
def before_request():
raw_text = open('facts.txt').read()
g.facts = raw_text.split('\n')
@chrisshroba
chrisshroba / slack-dogfacts.txt
Created May 4, 2016
Input data to my Slack bot, DogFacts
View slack-dogfacts.txt
Dogs are cute
It is a myth that dogs are color blind
Dogs DO have better low-light vision than humans because of a special light-reflecting layer behind their retinas
A German Shepherd guide dog led her blind companion the entire 2100 mile Appalachian Trail
If never spayed or neutered, a female dog, her mate, and their puppies could produce over 66,000 dogs in 6 years!
Dogs’ only sweat glands are between their paw pads
Like human babies, Chihuahuas are born with a soft spot in their skull which closes with age
The breed Lundehune has 6 toes and can close its ears
Teddy Roosevelt’s dog, Pete, ripped a French ambassador’s pants off at the White House
President Lyndon Johnson had two beagles named Him and Her
@chrisshroba
chrisshroba / clearscrollback.sh
Last active Mar 10, 2016
Function to clear all iTerm scrollback history
View clearscrollback.sh
# Clears all iTerm scrollback
# Useful to run before commands with long output
# (simply scroll to top to find beginning of output)
c () {
echo "\033]50;ClearScrollback\x7"
}
@chrisshroba
chrisshroba / pseudocode.py
Created Mar 7, 2016
473 Homework 5 #1a Pseudocode
View pseudocode.py
GetKSamples(stream S, int k):
samples = list of length k // samples is the list we'll return
for i gets 1...k:
samples[i] = next item in S // Add the first five items in the
// stream to samples
l <- k // Count of things seen so far
while S is not done
x <- next item in S
l <- l+1 // Increment count
if Random(l) <= k // With 5/l probability...
You can’t perform that action at this time.