Skip to content

Instantly share code, notes, and snippets.

View flicknow's full-sized avatar

mark flicknow

View GitHub Profile
#!/usr/bin/env node
const fs = require('node:fs');
const crypto = require("node:crypto")
const { subtle } = crypto.webcrypto;
async function main () {
if ( process.argv.length != 3 ) {
console.log(`USAGE: ${process.argv[1]} KEY-FILE`)
process.exit(1)
}
#!/usr/bin/env node
const cbor = require('@ipld/dag-cbor')
const fs = require('node:fs');
const { sha256 } = require('@noble/hashes/sha256')
const { secp256r1 } = require('@noble/curves/p256')
async function fetch_last (did) {
const logs = await fetch(`https://plc.directory/${did}/log/audit`).then(res => res.json())
const last = logs.pop()
return [ last.cid, last.operation ]
#!/usr/bin/env node
const cbor = require('@ipld/dag-cbor')
const fs = require('node:fs');
const { P256Keypair } = require('@atproto/crypto')
const { secp256r1 } = require('@noble/curves/p256')
const asn1 = require('asn1.js');
// More comprehensive ASN.1 parsing
const PrivateKeyInfo = asn1.define('PrivateKeyInfo', function() {
this.seq().obj(
#!/usr/bin/env node
const cbor = require('@ipld/dag-cbor')
const crypto = require("node:crypto")
const fs = require('node:fs');
const { subtle } = crypto.webcrypto;
async function fetch_last (did) {
const logs = await fetch(`https://plc.directory/${did}/log/audit`).then(res => res.json())
const last = logs.pop()
return [ last.cid, last.operation ]
// BLOCK YOUR OWN ACCOUNT
// -----------------------------
// Open the developer tools, and copy/paste this into the console tab:
(async () => {
const storage = JSON.parse(localStorage.BSKY_STORAGE);
const accessJwt = storage.session.currentAccount.accessJwt;
const repo = storage.session.currentAccount.did;
await fetch("https://bsky.social/xrpc/com.atproto.repo.createRecord", {
// COUNTS NUMBER OF MEMBERS IN A LIST
// -----------------------
// Navigate from https://bsky.app/ to the list you want to get member count of
// Open the developer tools, and copy/paste this into the console tab:
(async () => {
const [_, handle, rkey] = window.location.href.match(/https:\/\/bsky.app\/profile\/(.*?)\/lists\/(.*?)(?:\/|$)/) || [];
if (!handle) return console.error("The URL doesn't match the expected format.");
const did = !handle.startsWith("did:") ? (await (await fetch(`https://bsky.social/xrpc/com.atproto.identity.resolveHandle?handle=${handle}`)).json()).did : handle;
const { session } = JSON.parse(localStorage.BSKY_STORAGE);
@flicknow
flicknow / invite-codes.js
Created February 15, 2024 21:52
invite-codes.js
// GET INVITE CODES
// -----------------------------
// Open the developer tools, and copy/paste this into the console tab:
(async () => {
const storage = JSON.parse(localStorage.BSKY_STORAGE);
const accessJwt = storage.session.currentAccount.accessJwt;
const repo = storage.session.currentAccount.did;
await fetch("https://bsky.social/xrpc/com.atproto.server.getAccountInviteCodes", {
// FOLLOW YOUR OWN ACCOUNT
// -----------------------------
// Open the developer tools, and copy/paste this into the console tab:
(async () => {
const storage = JSON.parse(localStorage.BSKY_STORAGE);
const accessJwt = storage.session.currentAccount.accessJwt;
const repo = storage.session.currentAccount.did;
await fetch("https://bsky.social/xrpc/com.atproto.repo.createRecord", {
@flicknow
flicknow / wifiboob.js
Last active October 29, 2023 21:22
bookmarklet to bring back the wifi boob
javascript:(() => {svg = document.querySelectorAll('a[aria-label="Feeds"] svg')[0];svg.setAttribute('stroke', 'none');svg.setAttribute('stroke-width', '1.75');svg.setAttribute('viewBox', '0 0 22 22');svg.innerHTML = ' <path d="M16 19.6622C14.5291 20.513 12.8214 21 11 21C5.47715 21 1 16.5229 1 11C1 9.17858 1.48697 7.47088 2.33782 6.00002C3.18867 4.52915 6 7.66219 6 7.66219L14.5 16.1622C14.5 16.1622 17.4709 18.8113 16 19.6622Z" fill="currentColor"></path><path d="M8 1.62961C9.04899 1.22255 10.1847 1 11.3704 1C16.6887 1 21 5.47715 21 11C21 12.0452 20.8456 13.053 20.5592 14" stroke="currentColor" strokewidth="2.25" strokelinecap="round"></path><path d="M9 5.38745C9.64553 5.13695 10.3444 5 11.0741 5C14.3469 5 17 7.75517 17 11.1538C17 11.797 16.905 12.4172 16.7287 13" stroke="currentColor" strokewidth="2.25" strokelinecap="round"></path><circle cx="10" cy="12" r="2" fill="currentColor"></circle>'})()
@flicknow
flicknow / bluesky.js
Last active May 13, 2023 03:56
bookmarklet for replacing What's Hot with custom Bluesky feed
javascript:void(
fetch = (originalFetch => {
const customfeed = new URL("https://flicknow.xyz/xrpc/app.bsky.unspecced.getPopular");
const desc = "What's Not Promoted";
/* for my custom feed */
const label = "!no-promote";
let title = document.querySelectorAll('[data-testid="homeScreenFeedTabs-What\'s hot"]');
if ( title.length > 0 ) {