I hereby claim:
- I am bewt85 on github.
- I am bewt85 (https://keybase.io/bewt85) on keybase.
- I have a public key ASDtU4pLFN9jmDiQw7znCgeoI8rbIDXM7LRmbAvtK8AxMAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| import hashlib | |
| import json | |
| import logging | |
| import os | |
| import re | |
| import requests | |
| import subprocess | |
| import sys | |
| import time | |
| import urllib |
here-here is like history but it saves the time you ran a command and the directory you were in when you ran it.
Running here tells you all the commands you ran in this directory even if you were on a different server.
I commonly wonder how I made a file (and maybe why). Sometimes I try looking in my history (using the history command).
This makes that easier by clearing out some of the noise.
| const { Readable } = require('stream'); | |
| const logger = require("debug"); | |
| const _ = require("lodash"); | |
| const whenHttpRequestComplete = new Promise(resolve => setTimeout(resolve, _.random(100, 1000))); | |
| class SlowNumberSource extends Readable { | |
| constructor(options={}) { | |
| super(options); | |
| this.getNext = this.buildNext(1); |
| with open('foo', 'w') as foo: | |
| foo.write("bar\n") # writes bar | |
| with open('foo', 'wa') as foo: | |
| foo.write("baz\n") # writes baz, removes bar | |
| with open('foo', 'what will this do?') as foo: | |
| foo.write("nonsense\n") # removes bar, writes nonsense! | |
| with open('foo', 'something else') as foo: |
| import gevent | |
| class Try(object): | |
| def __init__(self, result): | |
| self.result = result | |
| class Success(Try): | |
| def __repr__(self): | |
| return "<Success '%s'>" % self.result |
| . | |
| ├── bar | |
| ├── foo | |
| ├── scripts | |
| │ ├── foobar.py | |
| │ └── __init__.py | |
| └── tests | |
| ├── foobar_test.py | |
| └── __init__.py |
| #!/bin/bash | |
| START_DIR=$(pwd) | |
| for dir in $(find . -name ".git" -type d); do | |
| cd $(echo $dir | sed 's/\/.git$//') && git checkout master && git pull && cd $START_DIR; | |
| done | |
| git status |
| #!/bin/bash | |
| set -ex | |
| ROOT_DIR=$(cd $(dirname $1); pwd)/$(basename $1) | |
| START_DIR=$(pwd) | |
| [[ -d ${START_DIR}/splits ]] || mkdir ${START_DIR}/splits | |
| for subProject in $(find $ROOT_DIR -mindepth 1 -maxdepth 1 -type d | grep -v git); do |
| #!/usr/bin/env python | |
| from hashlib import md5 | |
| import argparse, os | |
| parser = argparse.ArgumentParser(description="Makes pseudo-random but deterministic files of ascii text") | |
| parser.add_argument('output_file', help="Location of output file") | |
| parser.add_argument('size', nargs='?', default=1024, type=int, help="Size in bytes of output file") | |
| parser.add_argument('seed', nargs='?', default=None, help="A seed value to differentiate output files") | |
| args = parser.parse_args() |