Skip to content

Instantly share code, notes, and snippets.

@samm81
samm81 / assassins.bash
Created March 5, 2023 00:06
takes a list of people on stdin and generates files with assassin targets
#!/usr/bin/env bash
# unnoficial strict mode, note Bash<=4.3 chokes on empty arrays with set -u
# http://redsymbol.net/articles/unofficial-bash-strict-mode/
# https://sharats.me/posts/shell-script-best-practices/
set -o errexit
set -o nounset
set -o pipefail
IFS=$'\n\t'
shopt -s nullglob globstar
@samm81
samm81 / recipies.js
Created February 17, 2023 19:35
recipies.js: bookmarklet to search actually good recipie sites
javascript: let url = 'https://www.google.com/search?q={}+site%3Ahttps%3A%2F%2Fwww.seriouseats.com%2F+OR+site%3Ahttps%3A%2F%2Ffoodwishes.blogspot.com%2F+OR+site%3Ahttps%3A%2F%2Fwww.budgetbytes.com%2F+OR+site%3Ahttps%3A%2F%2Fcookieandkate.com%2F+OR+site%3Ahttps%3A%2F%2Fwww.halfbakedharvest.com%2F+OR+site%3Ahttps%3A%2F%2Fminimalistbaker.com%2F+OR+site%3Ahttps%3A%2F%2Fsmittenkitchen.com%2F+OR+site%3Ahttps%3A%2F%2Fwww.simplyrecipes.com%2F+OR+site%3Ahttps%3A%2F%2Fwww.blueapron.com%2F&hl=en'; let q = prompt('keywords'); q = q.replace(' ', '+'); url = url.replace('{}', q); window.location.href = url;
@samm81
samm81 / scrape_jefit_website.sh
Created January 18, 2021 00:38
Jefit.com workout scraper
# first and last days of data you want to export
start_date='2015-01-01'
end_date='2020-12-31'
curl_date() {
date="$1"
# you'll need to replace the cookie info with your cookie info
# you can get this info by logging into the jefit website then going to the web console "network" section, refreshing, and right clicking on the root request and selecting "copy as curl"
curl "https://www.jefit.com/my-jefit/my-logs/log/?dd=$date" \
-H 'Cookie: PHPSESSID=1111111111AAAAAAAAAA; dfsessionhash=11111111111aaaaaaaaaa; dflastvisit=11111111; dflastactivity=1111111111; dfpassword=111111111111111111111111aaaaaaaaaaaaaaaaaaa; dfuserid=11111111' \
@samm81
samm81 / splendor.py
Created September 3, 2017 23:56
Start to an implementation of splendor
from random import randrange, choice, sample
colors = [ 'red', 'blue', 'green', 'black', 'white' ]
# example cost gemstone points
card = ( {'red': 2, 'green': 2 }, 'white', 1 )
def genDeck1Card():
cost = { color: 0 for color in colors }
num_gemstones = randrange(3, 5+1)
@samm81
samm81 / emoji.elm
Created September 3, 2017 23:12
an old abandoned elm project where emoji run around on the page
module Main exposing (..)
import Html exposing (Html)
import Html.App as Html
import Html.Attributes exposing (style)
import Time exposing (fps, every, second)
import Signal exposing (Signal)
import Random exposing (Generator, Seed, initialSeed, int, float, generate)
import List exposing (head, tail)
import Graphics.Element exposing (Element, show)
@samm81
samm81 / add_new_cards.py
Last active September 15, 2017 23:46
Simple script to create an anki importable csv for new chinese flash cards.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from lxml import html
import requests
import sys
import readline
# curl 'http://www.yellowbridge.com/chinese/dictionary.php' -H 'Cookie: PHPSESSID=qijdue2gmrhs4pltdphjcqj3o2; _ga=GA1.2.112204757.1484656688; _gid=GA1.2.125872261.1495576784' -H 'Origin: http://www.yellowbridge.com' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.8' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36' -H 'Content-Type: application/x-www-form-urlencoded' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Cache-Control: max-age=0' -H 'Referer: http://www.yellowbridge.com/chinese/dictionary.php' -H 'Connection: keep-alive' -H 'DNT: 1' --data 'searchMode=P&word=shen2me' --compressed
headers = {
@samm81
samm81 / brickpop.py
Last active September 16, 2017 23:58
An automatic solver for facebook messenger's brickpop game. The code is a mess. Don't judge.
import pyautogui # this will require some packages or something to be installed
import time
cmap = { (253, 178, 54): 'y', (255, 109, 114): 'r', (14, 177, 156): 'g', (79, 150, 242): 'b', (179, 111, 238): 'p', (151, 136, 116): 'l', (247, 239, 228): '0', (20, 179, 158) : 'g' }
hgap = 49
vgap = 49
xo, yo = pyautogui.position()
def getColor(x, y, s):
@samm81
samm81 / whatshouldireadnext.com checker
Created February 22, 2015 22:59
Checks all the books on http://www.whatshouldireadnext.com/ when you're asking for a recommendation.
$(".checkbox > input").each(function () {this.checked=true;});
<html>
<body onload="go(1, true, 0)">
<div style="text-align:center; padding-top:200px; font-size:40px; line-height:80px;">
<div id="timer"></div>
<div id="exercise"></div>
</div>
</body>
<script>
var exercises = ["Preparing", "Running in Place", "Resting (Jumping Jacks Next)", "Jumping Jacks", "Resting (Jumping Squats Next)", "Jumping Squats", "Resting (Push Ups Next)", "Push Ups", "Resting (Bicycle Crunch Next)", "Bicycle Crunch", "Resting (Burpees Next)", "Burpees", "Resting (Mason Twist Next)", "Mason Twist", "Resting (Mountain Climbers Next)", "Mountain Climbers", "All Done!"];
@samm81
samm81 / eclipse-format-prefs.xml
Last active February 1, 2024 12:33
eclipse-format-prefs
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
<profile kind="CodeFormatterProfile" name="mine" version="12">
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>