Skip to content

Instantly share code, notes, and snippets.

View sofuture's full-sized avatar
:shipit:

Jeff Zellner sofuture

:shipit:
View GitHub Profile
@sofuture
sofuture / wordle.py
Last active February 10, 2022 17:25
wordle.py
#!/usr/bin/env python3
import os
words = "/usr/share/dict/words"
pattern = input("known regex: ")
scmd = f"grep \"^{pattern}$\" {words} | grep -v \"'\""
used_letters = input("used letters: ")
@sofuture
sofuture / ss.sh
Created April 1, 2020 23:37
make maim work like scrot for taking screenshots
#!/bin/bash
maim -s ~/$(date +%Y-%m-%d-%H%M%S)_maim.png
@sofuture
sofuture / bench.txt
Last active September 24, 2016 21:31
_ _
| |__ ___ _ __ ___ | |__
| '_ \ / _ \| '_ \ / __|| '_ \
| |_) || __/| | | || (__ | | | |
|_.__/ \___||_| |_| \___||_| |_|
3 week Smolov Jr. program -- working 1RM: 70
================================================
Week 1 Sets Reps Weight Worksheet
------ ---- ---- ------ ---------
@sofuture
sofuture / long_running_pid.sh
Last active July 26, 2016 16:41
get the pid of something that takes a long time to run
#!/bin/sh
set -m
something_that_takes_a_while &
PID=$!
echo "doing thing that takes a long time with pid: $PID"
fg
@sofuture
sofuture / passmenu.sh
Created June 15, 2016 20:49
passmenu
#!/usr/bin/env bash
shopt -s nullglob globstar
typeit=0
if [[ $1 == "--type" ]]; then
typeit=1
shift
fi
### Keybase proof
I hereby claim:
* I am sofuture on github.
* I am sofuture (https://keybase.io/sofuture) on keybase.
* I have a public key whose fingerprint is 94EA 21DD F42E 5C39 31A5 84F9 D327 A9A2 5A7C A5BB
To claim this, I am signing this object:
@sofuture
sofuture / gist:6b760f4663441b1abdb0
Created May 15, 2015 20:19
docopt-go default parsing doesn't seem to work
package main
import (
"fmt"
"github.com/docopt/docopt-go"
)
func main() {
args, _ := docopt.Parse(helpText, nil, true, "foo", false)
@sofuture
sofuture / gist:4068264
Created November 13, 2012 20:41 — forked from fdmanana/gist:832610
The CouchDB replicator database

1. Introduction to the replicator database

A database where you PUT/POST documents to trigger replications and you DELETE to cancel ongoing replications. These documents have exactly the same content as the JSON objects we used to POST to /_replicate/ (fields "source", "target", "create_target", "continuous", "doc_ids", "filter", "query_params".

Replication documents can have a user defined "_id". Design documents (and _local documents) added to the replicator database are ignored.

The default name of this database is _replicator. The name can be changed in the .ini configuration, section [replicator], parameter db.

2. Basics

(2*i.1+2%~#y) { (i.#y) #~ (-.10=y)+2*10=y
NB. Starting from the right...
NB. (-.10=y) + 2*10=y
NB. Where the ball is a 10, times 2, plus where the ball is NOT 10
NB. I.e. 1 for every ball that's not a strike, 2 for every strike
NB. (i.#y) #~ 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1
NB. (#~ is Copy, reversed with the adverb ~ -- so...)
NB. 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 1 1 1 # (i.#y)
NB. Copy our 1/2 array times from integers through length of rolls
NB. This allows us to pad out frames with only one ball (i.e. strikes)
fx=: 13 : '(2*i.1+2%~#y){(i.#y)#~(-.10=y)+2*10=y'
sf=: 13 : '_1}.(y+1|.!.0 y)+(2|.!.0 y)*(9<y+1|.!.0 y)'
sc1=: ([:+/fx{sf) rolls