chk
View long-history.sh
This file contains 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
#!/bin/bash | |
# Don't put duplicate lines in the history | |
export HISTCONTROL=ignoredups | |
# Store a lot history entries in a file for grep-age | |
shopt -s histappend | |
export HISTFILE=~/long_history | |
export HISTFILESIZE=50000 |
View getip.c
This file contains 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
#include <stdio.h> | |
#include <unistd.h> | |
#include <string.h> /* for strncpy */ | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <sys/ioctl.h> | |
#include <netinet/in.h> | |
#include <net/if.h> | |
#include <arpa/inet.h> |
View upload-to-bitsurge.sh
This file contains 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
#! /bin/bash | |
USER=tyree | |
FTPPASS= | |
HOST=john.bitsurge.net | |
SUBDIR="public" | |
if [[ "$1" == "-p" ]]; then | |
shift | |
SUBDIR="private" |
View composable.py
This file contains 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
#!/usr/bin/env python | |
# coding: utf8 | |
# GistID: 11062517 | |
from __future__ import division | |
import functools | |
import inspect | |
class composable(object): |
View optionModel.hs
This file contains 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
{-# OPTIONS_GHC -funbox-strict-fields #-} | |
{-# OPTIONS_GHC -fexcess-precision #-} | |
{-# OPTIONS_GHC -Odph #-} | |
{-# OPTIONS_GHC -O2 #-} | |
-- {-# LANGUAGE BangPatterns #-} | |
-- {-# LANGUAGE DoAndIfThenElse #-} | |
{-# LANGUAGE RankNTypes #-} | |
-- GistID: 8970316 |
View win_notify.py
This file contains 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
#!/usr/bin/env python | |
# coding: utf8 | |
# GistID: 8949940 | |
from os.path import abspath, expanduser | |
def on_modify(path, callback): | |
""" Watch a path for changes by write time, recursively. |
View big_O.py
This file contains 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
#!/usr/bin/env python2 | |
# GistID: 8910125 | |
from numpy import array, log, linspace | |
from matplotlib import pyplot as plt | |
# http://en.wikipedia.org/wiki/Big_o_notation#Family_of_Bachmann.E2.80.93Landau_notations # noqa | |
n = linspace(1, 100) | |
fn = log(n) / log(5) # log_5(n) | |
gn = log(n) / log(3) # log_3(n) |
View scree_plot.py
This file contains 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
#!/usr/bin/env python | |
# coding: utf8 | |
# GistID: 8785541 | |
from __future__ import division | |
import numpy as np | |
import matplotlib | |
import matplotlib.pyplot as plt |
View typed_functions.py
This file contains 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
#!/usr/bin/env python | |
# coding: utf8 | |
# GistID: 8605391 | |
""" Add type checking decorators to functions. | |
@in_types(int, str) | |
@out_types(str) | |
def mul(a, b): | |
return a * b |
NewerOlder