Skip to content

Instantly share code, notes, and snippets.

View jonmoshier's full-sized avatar

Jon Moshier jonmoshier

View GitHub Profile
@jonmoshier
jonmoshier / .lsd.sh
Created April 17, 2026 01:18
lsd — friendly DynamoDB CLI wrappers for AWS CLI
# lsd — friendly DynamoDB CLI wrappers
# Usage: lsd [subcommand] [args]
# lsd list all tables
# lsd info <table> describe a table (schema, keys, indexes)
# lsd scan <table> [n] scan up to n items (default 20)
# lsd get <table> <k> <v> get a single item by partition key
# lsd keys <table> show just the key schema
# lsd count <table> approximate item count
# lsd help show this help
# Rock, Paper, Scissors command line python3 game
# run at commandline by typing `python rock-paper-scissors.py`
from random import randint # import random for computer choice
class NotAChoiceException(Exception): # creating a custom exception to handle by inputs
"""doc statement about error"""
pass
def takeInput(): # the function that handles input
@jonmoshier
jonmoshier / genetic_algo.py
Created April 30, 2018 18:58
Another found on the hard drive gist, sticking it here for later, not sure that it works.
from random import random, randint
letters="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
def individual(len):
return [letters[int(round(random()*100)%26)] for x in xrange(len)]
def population(size, len):
return [individual(len) for x in xrange(size)]
@jonmoshier
jonmoshier / self_replicating_file.py
Created April 30, 2018 18:54
Cleaning out my hard drive and I found this self replicating python file I wrote 5 years ago. Saving for posterity.
#!/usr/bin/env python
# use unittest to test if new file equals original, will
# fail test if it does not.
import unittest
# Get the file name of 'this' file. Will be 'file.py'
ORIG_FILE_NAME = __file__
# Get the contents of the ORIGINAL FILE file.