This file contains hidden or 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
from functools import cmp_to_key, cache | |
import math | |
import re | |
import sys | |
filename = "16.in.test" | |
filename = "16.in" | |
This file contains hidden or 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
import sys | |
from collections import defaultdict | |
infile = open("5.in") | |
inlines = [l for l in infile] | |
stacks = defaultdict(list) | |
def part1(): | |
boxparsing = True |
This file contains hidden or 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
import com.something.Inner; | |
public class Test { | |
public static void main(String[] args) { | |
var one = new Inner(); | |
var second = new Inner(); | |
} | |
} |
This file contains hidden or 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 macro gets all the d20 rolled in a session and spits back what is the avg roll and all rolled d20 results. | |
// // step one, get all the messages with a d20 roll in them. | |
let arrays = {} | |
//let rollArray = [] | |
let rollResult = 0; | |
let rollMessages = game.messages.entities.filter(m => m.roll?.formula?.includes("d20") == true) | |
// // step two, get the rolled dice. | |
for (let message of rollMessages) { // takes an individual message from the rollMessages object. | |
let player = message.user.data.name; | |
for (let dice of message.roll.dice) { // allows us to check when there is multiple different die used in the formula if we are actually checking a d20. |
This file contains hidden or 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
package com.nope.maybe; | |
import com.google.cloud.pubsub.v1.AckReplyConsumer; | |
import com.google.cloud.pubsub.v1.MessageReceiver; | |
import com.google.cloud.pubsub.v1.Publisher; | |
import com.google.cloud.pubsub.v1.Subscriber; | |
import com.google.cloud.pubsub.v1.SubscriptionAdminClient; | |
import com.google.cloud.pubsub.v1.TopicAdminClient; | |
import com.google.protobuf.ByteString; | |
import com.google.pubsub.v1.PubsubMessage; |
This file contains hidden or 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
import base64 | |
import hashlib | |
import hmac | |
import struct | |
import sys | |
import time | |
def get_hotp_token(secret, intervals_no): | |
key = base64.b32decode(secret, True) |
This file contains hidden or 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
import static com.google.common.base.Preconditions.checkArgument; | |
public class MyObject { | |
public final String name; | |
public final String wat; | |
private MyObject(String name, String wat) { | |
this.name = name; | |
this.wat = wat; | |
} |
This file contains hidden or 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
String getRandomTwoLetterHexDigest(UUID timebased) { | |
checkArgument(timebased.version() == 1); | |
long timestamp = UUIDs.unixTimestamp(timebased); | |
ByteBuffer buffer = ByteBuffer.allocate(8); | |
buffer.putLong(timestamp); | |
// could add clocksequence as well | |
byte[] digest = DigestUtils.getSha256Digest().digest(buffer.array()); | |
return String.valueOf(Hex.encodeHex(digest)).substring(0, 2); | |
} |
This file contains hidden or 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
#!/bin/bash | |
# usage ./notify.sh [path to folder] [command line to execute on change] | |
while true | |
do | |
set -e | |
inotifywait -q -r --exclude ".git|.idea" -e close_write,moved_to,create $1 > /dev/null | |
set +e | |
eval ${*:2} |
This file contains hidden or 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
cache = {} | |
def cache_result(result, key): | |
cache[key] = result | |
return result | |
def cached(f): | |
def wrapped(*args): | |
if key(args) in cache: |
NewerOlder