Skip to content

Instantly share code, notes, and snippets.

View mkwatson's full-sized avatar

Mark Watson mkwatson

View GitHub Profile
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
@mkwatson
mkwatson / golf.sh
Last active July 16, 2021 17:52
Search US golf courses with jq
# You might want to download all_course_ratings.json locally first
# QUESTION: What's the jq command to only return the TeeRows for TeeName=White and Gender=Male for a given course?
# Below is the query to return all tee rows for a course, in this case Peacock Gap Golf Club:
curl https://golfcourses.s3.us-west-1.amazonaws.com/all_course_ratings.json | \
jq '
.[] |
select(
send_texts () {
available_number="XXXXXX". # Get this from twilio
mark="XXXXXX"
jennifer="XXXXX"
for number in $mark $jennifer ; do
curl -X POST -d "Body=There's availability at Metreon! https://myturn.ca.gov/" \
-d "From=$available_number" -d "To=$number" \
"https://api.twilio.com/2010-04-01/Accounts/$ACCOUNT_ID/Messages" \
############################
# UNION
############################
WITH t1(v) AS
(VALUES (1), (1), (2)),
t2(v) AS
(VALUES (2), (2), (3))
(SELECT DISTINCT v FROM t1)
UNION
@mkwatson
mkwatson / review-checklist.md
Created July 24, 2020 16:29 — forked from bigsergey/review-checklist.md
Front-end Code Review Checklist

Review checklist

General

  1. Does the code work?
  2. Description of the project status is included.
  3. Code is easily understand.
  4. Code is written following the coding standarts/guidelines (React in our case).
  5. Code is in sync with existing code patterns/technologies.
  6. DRY. Is the same code duplicated more than twice?
@mkwatson
mkwatson / pyenv+virtualenv.md
Last active February 3, 2020 21:42 — forked from tiagoamx/pyenv+virtualenv.md
Cheatsheet: pyenv, virtualenvwrapper, and pip

Cheatsheet: pyenv, virtualenvwrapper, and pip

Installation (for Mac OS)

Install pyenv with brew

brew update
brew install pyenv
@mkwatson
mkwatson / long.sql
Created January 30, 2020 04:13
long ass sql
WITH normalized_match(name, starttime, endtime, youtube_video, twitch_channel) AS
(VALUES
('Jan 24: Academy - C9 vs TL', TIMESTAMP '2020-01-25 01:00', TIMESTAMP '2020-01-25 01:40', '999FdvjJyPY', 'Academy'),
('Jan 24: Academy - DIG vs EG', TIMESTAMP '2020-01-25 01:00', TIMESTAMP '2020-01-25 01:40', '999FdvjJyPY', 'Academy'),
('Jan 24: Academy - TSM vs IMT', TIMESTAMP '2020-01-25 01:00', TIMESTAMP '2020-01-25 01:40', '999FdvjJyPY', 'Academy'),
('Jan 24: Academy - FLY vs CLG', TIMESTAMP '2020-01-25 01:00', TIMESTAMP '2020-01-25 01:40', '999FdvjJyPY', 'Academy'),
('Jan 24: Academy - 100T vs GG', TIMESTAMP '2020-01-25 01:49', TIMESTAMP '2020-01-25 02:20', '999FdvjJyPY', 'Academy'),
('Jan 25: LCS - C9 vs TL', TIMESTAMP '2020-01-25 22:06', TIMESTAMP '2020-01-25 22:32', '3KABoEyHqUM', 'LCS'),
('Jan 25: LCS - CLG vs DIG', TIMESTAMP '2020-01-25 22:58', TIMESTAMP '2020-01-25 23:38', '3KABoEyHqUM', 'LCS'),
('Jan 25: LCS - 100T vs GG', TIMESTAMP '2020-01-26 00:02', TIMESTAMP '2020-01-26 0
(defmulti sell-booze (fn [store person] [(over-21? person) (enough-supply? store) (enough-money? person)])
curl -X GET 'https://api.twitch.tv/helix/users?login=dignitas' \
-H 'Client-ID: kimne78kx3ncx6brgo4mv6wki5h1ko'
@mkwatson
mkwatson / Mod.idr
Last active July 13, 2018 00:33
Hoping to prove some things about modular congruences
%default total
{-
A few notes:
* I think maybe this should be called a Quotient Type
* There's a few fns where I'd ike to pattern match on n=(m ** prf) but instead am using fst and snd
-}
data Mod : (m ** Not (m = Z)) -> Type where
MkMod : (n : Nat) -> Mod m