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
from __future__ import print_function | |
import sys, time | |
from collections import deque | |
import curses, traceback | |
''' | |
Simple counter script | |
Originally used for counting pickup windings for an electric violin pickup. | |
Of course it would work well for any pickup winding activity. |
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
from __future__ import print_function | |
import re, sys | |
from nltk import ngrams, tokenize, download | |
from argparse import ArgumentParser | |
""" | |
#USAGE: | |
#This python file illustrates the techniques that Data For Research (http://dfr.jstor.org/) uses to tokenize raw text and generate n-grams | |
#DFR uses the NLTK 'punkt' tokenizer which needs to be downloaded separately from the nltk package. |
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
#Luke's Ultimate Prompt | |
#displays shortened time, username, shortened absolute path, git branch status colored red if dirty, colored smiley face indicating return code of previous command | |
#also includes a colored mortal kombat PS2 for those long commands. | |
#Written by Luke Hospadaruk with lots of help from the internet | |
find_git_branch() { | |
# Based on: http://stackoverflow.com/a/13003854/170413 | |
local branch | |
if branch=$(git rev-parse --abbrev-ref HEAD 2> /dev/null); then | |
if [[ "$branch" == "HEAD" ]]; then | |
echo -n ' detached*' |
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
#My pylintrc for use with atom.io's linter-pylint | |
[MESSAGES CONTROL] | |
disable=W0311,W1201,W0702,W0611 |
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
;Useful macro for creating objects that can be called like java objects. | |
;Handy for testing clojure functions that use java objects directly. | |
;Allows you easily create mock objects that can be passed into clojure functions | |
;EX: you have a clojure function that takes a curator LeaderLatch - the only functions you actually call are start(), hasLeadership(), and close() | |
;It would be a major hassle to implement a leader-latch subclass just to test that the function doesn't do any work unless it hasLeadership. | |
;You could implement a quick fake leader latch like: | |
;(fake-object | |
; (close [this] (comment "no-op")) |
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
(def operators [= < > <= >= not= + - * / mod and or not]) | |
(def functions [filter select]) | |
;not yet | |
;(def more_functions [select-distinct inner-join left-join group-by aggregate]) | |
;not yet | |
;(def agg_func [min max sum count ]) |
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/env python3 | |
from argparse import ArgumentParser | |
import boto3, time, sys, random | |
import urllib.parse as p | |
batch_size = 1000 | |
def rm_files(uri_list, total_num): | |
client = boto3.client('s3') | |
c = 0 |
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
#version of my ultimate prompt for the fish shell. MUCH easier to read! | |
function find_git_branch | |
# Based on: http://stackoverflow.com/a/13003854/170413 | |
set -l git_branch (git rev-parse --abbrev-ref HEAD 2> /dev/null) | |
if [ -z "$git_branch" ] | |
echo -n "" | |
else | |
if [ "$git_branch" = "HEAD" ] |
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 | |
#Handy update script for auto-updating your IP4 and IP6 dynamic DNS name if you use freedns.afriad.org. | |
#Probably other providers could be used as well if you modify the update URLs slightly | |
#uses opendns.com's magic resolver to try and figure out actual public-facing IP addresses | |
set -e | |
#To set up: | |
#go create an A record (for IP4) and a AAAA record (for IP6) for the same dynamic domain name | |
#replace the <angle bracketed sections> with the appropriate dynamic dns name and update URLs | |
MY_DOMAIN=<your freedns dynamic domain name> |
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 python3 | |
""" | |
Yet-another s3cat implementation. | |
streams files out of s3. | |
Requires boto3 | |
> pip3 install boto3 | |
Will use whatever your default credentials are locally (i.e. whatever you set up for awscli) |
OlderNewer