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
p.match(/.{1,16000}/gs).join("\"+\""); |
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
static float longToFloat(long input) { | |
double f = (double)input; | |
long rounded = (long)f; | |
double oneUlpDown = f * 1.1113332476497816e-16 - f + f; | |
if (f - 0.5 * oneUlpDown == f && rounded != input) { | |
f += (rounded > input != (input < 0)) ? -oneUlpDown : oneUlpDown; | |
} | |
return (float)f; | |
} |
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
#include <immintrin.h> | |
#include <inttypes.h> | |
#include <stdint.h> | |
#include <stdio.h> | |
// Convention: (a & (0xf << (4 * i))) >> (4 * i) is the ith nibble of a | |
// (i.e., lowest-significant is 0) | |
uint64_t shuffle_nibbles(uint64_t data, uint64_t indices) { | |
#if defined(__AVX512VBMI__) && defined(__AVX512VL__) | |
// If your data is already in vectors, then this method also works in parallel |
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
#!/usr/bin/python3 | |
# This code is hereby released under CC0. Use this code for whatever the fuck you want to, without attribution. | |
# Count instructions of each type and print them, sorted by count. Requires objdump. Insn counts are | |
# per executable section type. Buggy and silly, but entertaining. | |
import collections | |
import functools | |
import os.path |
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
#!/usr/bin/python3 | |
keys = { | |
"0": "[09]", | |
"1": "1", | |
"2": "2", | |
"3": "3", | |
"4": "4", | |
"5": "5", | |
"6": "6", |
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
/** | |
Copyright 2022 Timothy Herchen | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE |
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
let id, href; | |
if ((id = Array.from(document.querySelectorAll("link[rel=canonical]"))) && (href = id[0].href)) { | |
console.log("URL:", href); | |
console.log("id:", href.slice(href.lastIndexOf('/') + 1)); | |
} else { | |
throw new Error("Couldn't find channel id"); | |
} |
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
const fs = require("fs") | |
// Folder containing Hangouts.json | |
const dataFolder = "../timothy_herchen_gmail_hangouts/Hangouts" | |
// Folder to write chat texts to | |
const writeFolder = "./chats" | |
console.log("Reading in Hangouts data") |
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
2-Butanol | |
Acetal | |
Acetaldehyde | |
Acetyl Chloride | |
Acetyl Nitrate | |
Acrolein | |
Acrylic Acid | |
Acrylonitrile | |
Alcohols (Allylic, Benzylic) | |
Alidyy-Substituted Cycloaliphatics |
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
# Convert ISBNs in wikitext or list form into hyphenated ISBN 13s, and alert of any invalid ISBNs. | |
import re | |
import sys | |
import argparse | |
import stdnum.isbn | |
import pyperclip | |
isbn_as_argument_regex = re.compile(r"[iI]sbn\s*=\s*([0-9\- ]+)") | |
simple_isbn = re.compile(r"([0-9]\- ]{10,})") |
NewerOlder