Skip to content

Instantly share code, notes, and snippets.

@jacobian
jacobian / books.md
Last active September 25, 2024 16:44
Book recommendations from the Fediverse, June 2024

I asked for book recommendations on the fediverse and oh my goodness got so many suggestions. I wanted to share the list of all that came up in case others want to dig into this stuff. I asked specifically for

  • naturalist writing a la Muir or Abbey but about Alaska (I picked up Arctic Dreams but want more)
  • time travel / multiverse stuff, like Sliding Doors etc
  • great heists, fiction or non-
  • fiction featuring non-traditional families (queer, poly, etc.)
  • fantasy with really weird or different systems of magic, like Max Gladstone's Craft series

So most of this is falls into one of these themes, but also some stuff doesn't. I made this list quickly and sloppily, please forgive mispellings, missing author names, etc. Here's the list, sorted first by most common recs then alpha by title.

import string
import sys
import requests
import whois
from nltk import tokenize
BOOKFILE = sys.argv[1]
OUTPUTFILE = BOOKFILE + '.possible-domains.txt'
@ruphy
ruphy / GPT3.js
Last active November 2, 2023 23:41
GPT3() function for Google Sheets
// SPDX-License-Identifier: MIT
//
// This code will add a GPT3() function in your Google Sheets
// This code is originally inspired from https://twitter.com/fabianstelzer/status/1572926883179778050
// To use it, insert your API key below, open Google Sheets -> Extensions -> Apps Script -> Copy & Paste this -> Save
//
// Usage: =GPT3(prompt, max_tokens (default=15), model (default=davinci))
// Example usage: =GPT3("Once upon a time,", 1000, "davinci")
var API_KEY = "your-API-key";
library(tidycensus)
library(tidyverse)
us_county_density <- get_decennial(
geography = "county",
variables = "P1_001N",
year = 2020,
geometry = TRUE,
keep_geo_vars = TRUE
)
@thomaswilburn
thomaswilburn / tcaer.md
Created May 9, 2022 15:23
React but make it imperative

What if React was imperative instead of being functional?

When you write JSX, it compiles down to nested calls to createElement() (or the equivalent, I don't know if that's still the function React uses). Because this ends up being a single recursive function call, you can only use value expressions inside the code--that's why you have to map() when you loop, and you have to use ternaries instead of actual conditional statements.

Over time, the React team's thinking about architecture has clearly shifted a lot, to the point now where hook functions create implicit, hidden state that's preserved in the order of the function calls. What if JSX worked this way? What if when you wrote a template, instead of a single function call with nested expressions, it used imperative, IMGUI-like function calls instead? In that case, the raw code might look something like this:

template(html => {
  var { footer, a, button, text, div, ul, li } = html;
  div`.outer`;
@tennantje
tennantje / convert_olm_to_eml.py
Last active December 21, 2023 18:21
Convert Outlook for Mac (OLM) to EML files as PST conversion tools are expensive
# MIT LICENSE
# Copyright 2021 Jeremy Tennant
# 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 SOFTWA
@iTrooz
iTrooz / main.py
Last active October 22, 2024 03:43
reMarkable 2 splash.dat converter
#!/usr/bin/env python3
"""
This script aims at converting an image to the custom format used by Remarkable 2
After running this script, move the output "splash.dat" file to /var/lib/uboot in the rM2 device
I tried this with PNG images but I guess other formats should work too since I use PIL
Syntax: ./main.py <file> [-x xOffset] [-y yOffset]
(-x and -y are the offsets of the image on the screen. If not set, the image will be centered on the screen)
Input images may need to be rotated 90 degrees before converting them
Licence: MPL 2.0
"""
@mildsunrise
mildsunrise / blobs.py
Last active May 16, 2024 07:22
Logic to work with Android KeyMaster blobs and Vold
#!/usr/bin/env python3
'''
keymaster blob logic.
Offers:
- low-level blob encoding and decoding
- loading softkeymaster blobs
- performing cryptographic operations (emulating KeyMaster) on a loaded blob
- CLI tool for parsing softkeymaster blobs and performing operations with them
@rdmurphy
rdmurphy / TOOLS.md
Last active April 19, 2022 18:07
Ryan's favorite command line tools
@hervenivon
hervenivon / contacts-extractor.py
Created June 25, 2021 12:35
Outlook Mac `olm` archive contact extractor
#!/usr/bin/env python
import re
import sys
import xml.etree.ElementTree as ET
from collections import Counter
from zipfile import ZipFile
messageRe = re.compile('.*message_[0-9]{5}\.xml')