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
// Crawl Planets Toward Origin | |
// | |
// Capture unowned planets around you, but heading toward coordinates 0,0. | |
// This is mostly the stock "crawl planets" plugin with like 5 lines of changes. | |
import { EMPTY_ADDRESS } from "https://cdn.skypack.dev/@darkforest_eth/constants"; | |
import { | |
PlanetType, | |
PlanetTypeNames, | |
PlanetLevel, |
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
West Country Girl | |
With a crooked smile and a heart-shaped face | |
Comes from the West Country where the birds sing bass | |
She's got a house-big heart where we all live | |
And plead and counsel and forgive | |
Her widow's peak, her lips I've kissed | |
Her gloves of bone at her wrist | |
That I have held in my hand | |
Her Spanish fly and her monkey gland |
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
"""check_vaccine.py | |
Checks CVS for vaccine appointment availability and sends text messages if they show up. | |
Requires paid account on Twilio. You can fund $5 and it'll be plenty, a SMS is less than 1 cent. | |
Assuming you use a *nix system with Python 3 and want to deploy via crontab, you can do something like this: | |
1. `which python` Record the output. (It's nice to give crontab the full path of your python binary.) | |
2. `export VISUAL=vim` (For `crontab -e` to use vim; my personal preference.) | |
3. `crontab -e` to create a new line in your crontab. Next line is an example: |
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
"""Python GraphViz dot generator. Create simple GraphViz dot code from a graph | |
builder API. | |
The goal is to hook this up with a GUI at some point. | |
Future Improvements | |
* Potentially subprocess the graphviz generator to allow this to spit out | |
graphviz SVG or PNG files! | |
* UI that calls this API when you click certain elements. | |
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
"""Playing with means. | |
Geometric and Arithmetric means will only ever be equal when every item on the | |
list is the same. So if you keep entering 2,2,2,2,2,2,etc the two averages will | |
be the same. As soon as a new value is in the list the two values will diverge. | |
You can use this to look at how much the values diverge by with the introduction of outliers. | |
""" | |
class MovingAvg(object): |
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
"""spelling_bee.py: Creates puzzles for NYT's spelling bee game. | |
Computers are fast. This leverages a ton of linear passes through a dictionary | |
because it's just for fun and puzzle examples still come back in under a second. | |
Performance improvements left as exercise to the reader. | |
No dependencies beyond Python 2.7+. | |
Author: Sam Liu <sam@ambushnetworks.com> | |
License: MIT |
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 | |
from datetime import datetime, timedelta | |
import time | |
import sys | |
import os | |
if len(sys.argv) is 3: | |
music_service = str(sys.argv[1]) | |
minutes_to_wait = float(sys.argv[2]) | |
else: |
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 | |
from datetime import datetime as dt | |
import sys | |
def main(): | |
if len(sys.argv) < 3: | |
print ('Converts epoch milis/micros to human-readable timestamps.\n' | |
'Usage: ./convert_epoch_time.py micros <micros>\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
// This is a module that uses SQLite as a flat-file database to implement a simple key-value store. | |
// | |
// Exported methods: | |
// get(key, callback) - Retrieve the value for a given key in the store. | |
// insert(key, value) - Add a key/value to the store. If the key already exists, update its value. | |
// getAll(callback) - Retrieve all values in the database | |
// resetdb() - Reset the database | |
// | |
// Since this uses SQLite, it's locking and will likely have scalability issues when many concurrent users are | |
// accessing the database. Sequelize allows you to replace sqlite with a more production-ready database such |
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
# Translate binary into english characters. | |
# Written to translate a PostSecret on 01-24-2016. | |
# | |
# Author: Sam Liu <sam@ambushnetworks.com> | |
# | |
# 01001001001000000110101101101110011011110111 | |
# 01110010000001001001001001110110110100100000 | |
# 01100001001000000110011101100101011001010110 | |
# 10110010111000100000010010010010011101101101 | |
# 001000000111000001110010011011110111010101100 |
NewerOlder