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
# | |
# So it turns out you can write π/4 as the product of all odd prime numbers, each one divided by the multiple of 4 nearest to it: | |
# | |
# π/4 = 3/4 × 5/4 × 7/8 × 11/12 × 13/12 × 17/16 × 19/20 × 23/24 × ... | |
# | |
# see https://twitter.com/BarakShoshany/status/1581710946443018240 | |
from math import pi | |
odd_primes = [3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 8 |
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 | |
# | |
# track unfollowers on twitter | |
# | |
cd $HOME/twitter | |
if [ ! -f $HOME/twitter/prev_followers.txt ]; then | |
t followers > prev_followers.txt |
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
{ | |
"name": "slackbot", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"create": "AWS_PROFILE=AKIAIPB5V3GZKYRNXBTQ AWS_REGION=us-west-2 arc-create", | |
"deploy": "AWS_PROFILE=AKIAIPB5V3GZKYRNXBTQ AWS_REGION=us-west-2 arc-deploy" | |
}, | |
"keywords": [], |
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
# this is an .arc file! | |
@app | |
hellobot | |
@html | |
get / # displays Add to Slack | |
get /install # saves a bot token and redirects back to / | |
get /signin # saves a user token and redirects back to / | |
@slack # sets up slack api urls | |
bot |
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
" Algorithm 7.2.1.3T TAOCP by Donald Knuth: Lexicographic Combinations | |
This algorithm is like Algorithm L, but faster. It assumes, for convenience, t < n | |
Return a list of digits from 1 to n taken t at a time, in lexicographic order" | |
"T1. Initialize" | |
initializeStep := [ | |
c := Array new: t + 2. | |
(1 to: t) do: [:j1 | c at: j1 put: (j1-1)]. | |
c at: t + 1 put: n. |
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
"Return a list of all the combinations of a list of tokens taken k items at a time" | |
| combinations choices | | |
combinations := [:tokens :k | | |
(k <= 0) ifTrue: [OrderedCollection new] ifFalse: [ | |
((tokens size == 0) or: [k == tokens size]) | |
ifTrue: [OrderedCollection with: tokens] | |
ifFalse: [ | |
choices := combinations value: (tokens copyFrom: 2 to: tokens size) value: k-1. | |
choices := (choices isEmpty |
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/python | |
# -*- coding: UTF-8 -*- | |
# | |
# tilt-distance.py - calculate the horizontal distance to a target given camera pixel offset value | |
# | |
# To find d, the distance of the target from the camera, along the ground | |
# See https://drive.google.com/open?id=0B6e2rOpUwmteMWtOREdHSGdqOTg | |
# | |
# The triangle ΔABC is complementary to ΔDEC | |
# |
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
# | |
# tic_tac_toe.py - tic-tac-toe game | |
# | |
# 2014-02-07 Steven Wart created this file | |
# | |
from sys import stdout | |
from math import sqrt | |
# Print out an 3x3 tic-tac-toe board showing the positions of the pieces |
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
# | |
# knights_tour.py - knight's tour puzzle | |
# | |
# 2014-02-06 Steven Wart created this file | |
# | |
from sys import stdout | |
from math import sqrt | |
# Print out an 8x8 chessboard showing the positions of the pieces |
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
# | |
# 8queens.py - 8 queens problem | |
# | |
# 2014-02-05 Steven Wart created this file | |
# | |
from sys import stdout | |
# Print out an 8x8 chessboard showing the positions of the pieces | |
def draw_board(board): |
NewerOlder