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
const getSvgNamesForNodes = () => { | |
// this is guesswork. When Figma has two nodes with the same name (say, "Union"), | |
// it serialises them into SVG with names "Union" and "Union_2", but it's not | |
// clear which one becomes "Union" and which "Union_2". It is theorised that this | |
// is done in the same order that .findAll returns, so we make use of that. | |
// Figma might decide to change this at any time, of course. It would be much | |
// nicer if there were an SVG export option which also serialised getPluginData() | |
// data as data-* attributes in the output SVG, but there isn't, yet. | |
let names = {}; | |
let nameIndices = {}; |
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
<?php | |
// get this data by logging into icloud.com on the calendars page and looking at the dev tools | |
// as per https://translate.google.com/translate?sl=de&tl=en&js=y&prev=_t&hl=de&ie=UTF-8&u=http%3A%2F%2Fnico-beuermann.de%2Fblogging%2Farchives%2F115-Zugriff-auf-iCloud-Kalender-mit-Thunderbird.html&edit-text=&act=url | |
$account = array( | |
'server' => '', // note, this will be p12 or something, not P0; see the server that iclod.com serves json from | |
'icloudid' => '', // the "dsid" | |
'appleid' => '', // your Apple ID; will be an email address | |
'pass' => '', // password for your Apple ID | |
'calid' => '' // the "pGuid" |
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
from atproto.firehose import FirehoseSubscribeReposClient, parse_subscribe_repos_message | |
import sys | |
from atproto import CAR, models | |
from atproto.cbor import decode_dag, decode_dag_multi | |
from atproto.xrpc_client.models.utils import get_or_create | |
import json | |
class JSONExtra(json.JSONEncoder): | |
"""raw objects sometimes contain CID() objects, which | |
seem to be references to something elsewhere in bluesky. |
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 | |
import requests | |
import requests_cache | |
import json | |
requests_cache.install_cache('masto_cache') | |
MASTODON_USERNAME = "sil@mastodon.social" | |
def fetch(endpoint): | |
url = f"https://{server}/api/v1/accounts/{account_id}/{endpoint}" |
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 is $a, $b, expected answer for imul($a, $b) | |
$ cat tests/imul.txt | |
2,4,8 | |
1,1,1 | |
10,10,100 | |
-1, -2, 2 | |
1, 2, 2 | |
-1, 2, -2 | |
1, -2, -2 | |
-0, 0, 0 |
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 | |
""" | |
Find "tubewhacks"; words or phrases whose letters appear in all but a single tube station's name | |
https://www.reload.me.uk/tubewhack/ | |
Yeah, I'm just here to ruin the fun of thinking them up, by applying code to the problem. Sorry. | |
""" | |
import os | |
import textwrap |
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
from pelican import signals | |
import json, urllib, urlparse, datetime, html5lib, os, codecs | |
LIVESITEURL = "" | |
WM_CACHE_PATH = None | |
WM_CACHE = { | |
"domains": {}, | |
"pinged": {} | |
} |
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 | |
import sys, subprocess | |
HIGHLIGHT_BEFORE = "👉" | |
HIGHLIGHT_AFTER = "👈" # if you just want a highlight before, make this "" | |
cmd = ["aspell", "pipe"] | |
# add any extra options given to our command to the aspell command | |
if len(sys.argv) > 2: | |
cmd += sys.argv[1:] | |
for line in sys.stdin.readlines(): | |
# feed the line to aspell; will throw obvious error on failure |
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 | |
""" | |
Github won't let you say "don't subscribe me to new repos" for | |
one specific org only. You can either turn off autosubscribe | |
for everything, or for nothing. | |
This is extremely annoying if you're added to a very busy | |
new organisation, most of which you don't care about. This is | |
because you don't want to turn off all autosubscriptions -- if your | |
friend adds you to her new repo as a committer, you still want |
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 | |
import requests | |
try: | |
from requests_cache import CachedSession as MySession | |
except: | |
MySession = requests.Session | |
def unstring(s): |
NewerOlder