Skip to content

Instantly share code, notes, and snippets.

Avatar

Colten Jackson jazzyjackson

View GitHub Profile
View advent.js
input
.split('\n')
.map((e, i, a) => i && a[i] - a[i - 1])
.filter(n => n > 0)
.length
// 1527
// create a new array, then scan the input, adding each element to its coresponding index and the next two indexes as well
// is the number of additions any different than looking ahead and behind for each of them?
// for 1st strategy, for each element, I read 3 and write once.
View windows swap ctrl
Windows Registry Editor Version 5.00
; credit to https://superuser.com/questions/949385/map-capslock-to-control-in-windows-10
; The hex data is in five groups of four bytes:
; 00,00,00,00,\ header version (always 00000000)
; 00,00,00,00,\ header flags (always 00000000)
; 04,00,00,00,\ # of entries (3 in this case) plus a NULL terminator line.
; Entries are in 2-byte pairs: Key code to send & keyboard key to send it.
; Each entry is in "least significant byte, most significant byte" order,
; e.g. 0x1234 becomes `34,12`
; 1d,00,3a,00,\ Send LEFT CTRL (0x001d) code when user presses the CAPS LOCK key (0x003a)
View crack.js
function printOurSailor(allPublicKeys, candidatesSeed){
for(var candidateSeed of candidatesSeed){
let keychain = this.CryptoService.mnemonicToKeychain(candidateSeed)
let seedHex = this.CryptoService.keychainToSeedHex(keychain)
let privateKey = this.CryptoService.seedHexToPrivateKey(seedHex)
let publicKey = this.CryptoService.privateKeyToBitcloutPublicKey(privateKey, "mainnet")
if(allPublicKeys.has(publicKey)){
console.log("Our sailor is" + publicKey + " mnemonic: " + candidateSeed)
}
}
View sixes
bamboo
banana
banner
barely
barrel
basket
battle
cactus
camera
cancel
@jazzyjackson
jazzyjackson / cors.py
Created April 22, 2021 21:42 — forked from JosePedroDias/cors.py
mitmproxy CORS
View cors.py
# based on https://gist.github.com/jhass/652dd780d23c1e236ff913e8a2b77eb2
# http://jsbin.com/wonitaqode/edit?js,output
# mitmproxy -s cors.py
# mitmdump -s cors.py
from mitmproxy import http
def response(flow):
h = flow.request.headers
View bitclout-api-example.json
{
"ProfilesFound": [
{
"PublicKeyBase58Check": "BC1YLi6LpXTemAG8T9ptyWAkMywrjynwZcKjB5DkDXxrsG5kgAwAqxq",
"Username": "maebeam",
"Description": "buidling bitclout",
"ProfilePic": "data:image/jpeg;base64,/9j/2wCEAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDIBCQkJDAsMGA0NGDIhHCEyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMv/AABEIAGQAZAMBIgACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APTqSlq
View advent_day2a.js
let input = [
"1-3 a: abcde",
"1-3 b: cdefg",
"2-9 c: ccccccccc"
]
// wrong
// function testpassword(line){
// let [_, lower, upper, char, password] = line.match(/^(\d+)-(\d+)\s(\w):\s(\w+)$/)
// console.log(line, {lower, upper, char, password})
View adventofcalendarday1_c.js
// Find the complement to each highest number and search the lower numbers for the complement
// So it could be recursive, given a sorted array, loop through it from the top down, handing the lower half of the list to yourself
// base case: I have 2 numbers to fill.
let goal = 2020
let list = [1721, 979, 366, 299, 675, 1456]
let [a,b] = findsum(list, goal, 2)
console.log(a, b, a + b, a * b)
// 1721 299 2020 514579
View adventofcalendarday1_b.js
// complement sum
// ask "what is the complement for x number" and then "Do I have it?"
let goal = 2020
let marbles = new Set([1721, 979, 366, 299, 675, 1456])
let complement
main:
for(var marble of marbles){
complement = goal - marble
if(marbles.has(complement)){
View adventofcalendarday1.js
// blackjack sum
// given a goal sum and a list of integers, find pairs that add up to the goal
// return their product
// worse-case quadratic, for each in the list, I check all possibilities from the bottom up
// start at the highest number, scan up from the bottom, as soon as I break my goal I exit
let goal = 2020
let bottomup = [1721, 979, 366, 299, 675, 1456].sort((a,b) => a - b) // sort from the largest to the smallest
let topdown = bottomup.slice().reverse()