Skip to content

Instantly share code, notes, and snippets.

View j2kun's full-sized avatar
💭
Math math math math math math math

Jeremy Kun j2kun

💭
Math math math math math math math
View GitHub Profile
import argparse
import datetime
import requests
import sys
from scripts import utils as utils
def get_dois_from_page(page, since_days):
posts = page["hits"]
dois = dict()
@j2kun
j2kun / util.py
Created October 30, 2024 22:10
webmention utils
import indieweb_utils
def send_webmention(source_url, target_url, dry_run=False):
print(f"Found a webmention: {source_url} -> {target_url}")
try:
indieweb_utils.discover_webmention_endpoint(source_url)
except Exception as e:
print(f"Error discovering webmention endpoint: {e}")
import datetime
import fire
import marko
from scripts.webmention.utils import send_webmention
from scripts import utils as utils
DATABASE_PATH = "scripts/webmention/outgoing_processed.txt"
@j2kun
j2kun / hn.py
Created October 30, 2024 22:06
from bs4 import BeautifulSoup
from urllib.parse import urlparse
import argparse
import datetime
import pprint
import requests
import sys
from scripts.webmention.utils import send_webmention
"""Add URLs to blogroll database.
scripts/blogroll.txt is a flat file containing URLs and titles of blog posts
I submitted via https://github.com/j2kun/extension-trigger-gh-workflow
Each entry contains two lines: the first line is a URL and the second is a
title extracted from the URL. Entries are separated by a blank line.
Example:
import os
import fire
from atproto import Client, models
from scripts import utils as utils
from scripts import syndication as syndication
# A simple text file with two urls per line
DATABASE_FILE = "scripts/published_bluesky.txt"
BLUESKY_HANDLE = "jeremykun.com"
import os
import time
from scripts import utils as utils
from scripts import syndication as syndication
import fire
import tweepy
# A simple text file with two urls per line
@j2kun
j2kun / utils.py
Created October 30, 2024 06:00
Utils for social media syndication
from collections import deque, defaultdict
from itertools import zip_longest
import datetime
import os
import pathlib
import re
import subprocess
import marko
import os
import pathlib
import pprint
import re
import subprocess
import fire
import marko
from mastodon import Mastodon
@j2kun
j2kun / out.mlir
Created March 3, 2024 04:52
out.mlir after --straight-line-vectorize
module {
func.func @box_blur(%arg0: !secret.secret<tensor<4096xi16>>) -> !secret.secret<tensor<4096xi16>> {
%cst = arith.constant dense<4096> : tensor<64xindex>
%cst_0 = arith.constant dense<[49, 16, 62, 7, 45, 4, 25, 11, 37, 58, 29, 21, 50, 41, 33, 54, 46, 48, -1, 61, 17, 3, 10, 26, 6, 34, 57, 38, 22, 53, 30, 42, 31, 60, 47, 2, 18, 14, 5, 39, 13, 9, 23, 52, 27, 56, 35, 43, 19, 15, 8, 44, 40, 12, 1, 24, 20, 51, 28, 59, 36, 32, 55]> : tensor<63xindex>
%cst_1 = arith.constant dense<4096> : tensor<128xindex>
%cst_2 = arith.constant dense<"0x1D0000000000000004000000000000001000000000000000040000000000000010000000000000003A000000000000003A000000000000003E000000000000003E0000000000000036000000000000000B0000000000000019000000000000002D0000000000000007000000000000000B0000000000000036000000000000002D000000000000002100000000000000070000000000000021000000000000003200000000000000290000000000000011000000000000001500000000000000250000000000000029000000000000001500000000000000250000000000000032000000000000