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
console.log('working') | |
alert('working') |
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
function uint6ToB64 (nUint6) { | |
// Taken from https://developer.mozilla.org/en-US/docs/Glossary/Base64 | |
return nUint6 < 26 ? | |
nUint6 + 65 | |
: nUint6 < 52 ? | |
nUint6 + 71 | |
: nUint6 < 62 ? | |
nUint6 - 4 | |
: nUint6 === 62 ? | |
43 |
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 file helps unify code style. | |
; | |
; Plugins are available for | |
; notepad++, emacs, vim, gedit, | |
; textmate, visual studio, and more. | |
; | |
; See http://editorconfig.org for details. | |
# top-most EditorConfig file | |
root = true |
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
# Using this article as a basis: https://metinmediamath.wordpress.com/2013/11/27/how-to-calculate-the-elo-rating-including-example/ | |
print("Scenario: If you are a ELO 2000 player, why can't you play against an ELO 400 player enough times that you get infnite ELO?\n") | |
r1 = 2000 | |
r2 = 400 | |
R1 = 10**(r1/r2) # 10^(2400/400) = 100,000 | |
R2 = 10**(r2/r1) # 10^(800/400) = 10 |
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 script will check whether listed tlds will resolve to an IP address | |
import re | |
import requests | |
import socket | |
PUBLIC_SUFFIX_URL = 'https://publicsuffix.org/list/public_suffix_list.dat' | |
resp = requests.get(PUBLIC_SUFFIX_URL) | |
resptext = resp.text | |
# Remove comments and double new lines |
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
# Auto increment Z of X.Y.Z if a new pull request is merged | |
LATEST_TAG=$(git describe --abbrev=0) | |
INITIAL_TAG=$LATEST_TAG | |
for i in $(git log $LATEST_TAG..HEAD --format="%cI %H" | sort -rV | grep "Merge pull request" | awk '{ print $2 }'); do | |
NEXT_TAG=$(echo $LATEST_TAG | awk -F. -v OFS=. '{$NF++;print}') | |
BODY_ABBREV="$(git show $i --format=%b | head -n1)" | |
git tag -a "$NEXT_TAG" -m "Tag for $BODY_ABBREV" $i | |
printf "Tagging commit $i with $NEXT_TAG and pushing to master\n" | |
git push origin "$NEXT_TAG" | |
LATEST_TAG=$NEXT_TAG |
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
javascript:(function(){ | |
// Author: Ross Jacobs | |
// Purpose: Use as a browser bookmarklet to bulk delete notion pages in trash | |
// License: Apache 2.0 | |
async function getSpaceId() { | |
resp = await fetch("https://www.notion.so/api/v3/loadUserContent", {"credentials":"include","headers":{"accept":"*/*","cache-control":"no-cache","content-type":"application/json","pragma":"no-cache","sec-fetch-mode":"cors","sec-fetch-site":"same-origin"},"referrerPolicy":"same-origin","body":"{}","method":"POST","mode":"cors"}); | |
json = await resp.json(); | |
spaceId = Object.keys(json.recordMap.space)[0]; | |
return spaceId; | |
} |
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 script moves a shark across a terminal screen. A toy example is shown below, with the same mechanism. | |
ABCDE | |
FGHIJ | |
KLMNO | |
PQRST | |
Only show a bit mask consisting of 3x2 chars like |
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 bash | |
# Ross Jacobs 2020 Apache2 | |
# Demonstrates that tshark will consistently lose some percentage of packets. | |
# Change sleep number as suits your needs. | |
# | |
# See also https://www.networkcomputing.com/networking/wireshark-packet-capture-tshark-vs-dumpcap | |
cd /tmp | |
tshark -q -w tshark.pcap & tshark_pid=$! | |
dumpcap -q -w dumpcap.pcap & dumpcap_pid=$! |
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 python3 | |
# Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
# Use of this source code is governed by a BSD-style license that can be | |
# found in the LICENSE file. | |
# Modified to work with python3 by Ross Jacobs | |
# A simple native messaging host. Shows a Tkinter dialog with incoming messages | |
# that also allows to send message back to the webapp. | |
try: | |
import struct | |
import sys |
NewerOlder