Skip to content

Instantly share code, notes, and snippets.

View audiodude's full-sized avatar

Travis Briggs audiodude

View GitHub Profile
@audiodude
audiodude / create_defs.py
Created October 11, 2024 03:00
Psuedo code for updating wikitionary
# csv is built in
import csv
# requests must be installed with `pip`. See also: virtual environment.
import requests
# #Use this instead of reader[:10] to get a random 10 instead of the first ten.
# import random
# random.sample(reader, 10)
# Double quoted strings will allow for multiple lines, but all of the whitespace will be preserved,
class Fruit:
def __init__(self, name):
self.name = name
apple = Fruit('apple')
apples = {
'apple': apple,
@audiodude
audiodude / output.txt
Created January 5, 2024 03:50
Increment random value from a dictionary
fruits={'apple': 0.49, 'banana': 0.69, 'peach': 1.29, 'pear': 1.49, 'watermelon': 2.99}
Incrementing banana by 1
fruits={'apple': 0.49, 'banana': 1.69, 'peach': 1.29, 'pear': 1.49, 'watermelon': 2.99}
@audiodude
audiodude / delete_posts.py
Last active December 17, 2023 06:49
Delete all of your Mastodon posts using your token
from datetime import datetime
import time
import requests
import tqdm
API_TOKEN = 'YOUR_API_TOKEN'
ACCOUNT_ID = 'YOUR_ACCOUNT_ID'
requested = False
{
"actor": "https://travisbriggs.com/digital.garden",
"type": "Create",
"published": "2023-11-14T00:00:00.000Z",
"id": "https://travisbriggs.com/garden/compost/publish",
"to": [
"https://www.w3.org/ns/activitystreams#Public"
],
"object": {
"attributedTo": "https://travisbriggs.com/digital.garden",
@audiodude
audiodude / post.js
Last active November 21, 2023 02:13
Manually POST to Mastodon inbox with HTTP signature in Node/JS
import * as fs from 'node:fs/promises';
import crypto from 'node:crypto';
import fetch from 'node-fetch';
const document = {
"actor": "https://travisbriggs.com/digital.garden",
"type": "Create",
"published": "2023-11-14T00:00:00.000Z",
"id": "https://travisbriggs.com/garden/compost/publish",
"to": [
import requests
from wp1.exceptions import Wp1RetryableSelectionError, Wp1FatalSelectionError
<SNIP>
try:
r = requests.post('https://query.wikidata.org/sparql',
headers={'User-Agent': WP1_USER_AGENT},
data={
@audiodude
audiodude / gem.bestalbumsintheuniverse.com.conf
Created November 19, 2022 01:51
Drop this in /etc/supervisor/conf.d/
[program:twins]
command=/home/tmoney/go/bin/twins --config /home/tmoney/.config/twins/config.yaml
user=tmoney
@audiodude
audiodude / error.txt
Created November 16, 2022 04:02
Error building with vite build
$ vite build
vite v3.2.4 building for production...
transforming...
✓ 71 modules transformed.
'default' is not exported by node_modules/datatables.net/js/jquery.dataTables.js, imported by src/components/MyLists.vue
file: /home/runner/work/wp1/wp1/wp1-frontend/src/components/MyLists.vue:79:0
77: import $ from 'jquery';
78: $.noConflict();
79: import DataTable from 'datatables.net';
^
import json
from wp1.custom_tables.us_roads import CustomTable as CT
from wp1.wp10_db import connect as wp10_connect
params = {
'wiki_path':
'Highways',
'template':
'us_roads.jinja2',