Skip to content

Instantly share code, notes, and snippets.

@gd3kr
gd3kr / embeddings.py
Created February 15, 2024 20:35
compute embeddings for tweets in tweets.json
"""
a simple script that reads tweets inside a json file, uses openai to compute embeddings and creates two files, metadata.tsv and output.tsv, which cam be used to visualise the tweets and their embeddings in TensorFlow Projector (https://projector.tensorflow.org/)
"""
# obtain tweets.json from https://gist.github.com/gd3kr/948296cf675469f5028911f8eb276dbc
import pandas as pd
import json
from openai import OpenAI
@gd3kr
gd3kr / script.js
Created February 15, 2024 06:30
Download a JSON List of twitter bookmarks
/*
the twitter api is stupid. it is stupid and bad and expensive. hence, this.
Literally just paste this in the JS console on the bookmarks tab and the script will automatically scroll to the bottom of your bookmarks and keep a track of them as it goes.
When finished, it downloads a JSON file containing the raw text content of every bookmark.
for now it stores just the text inside the tweet itself, but if you're reading this why don't you go ahead and try to also store other information (author, tweetLink, pictures, everything). come on. do it. please?
*/
@gd3kr
gd3kr / autocomplete.js
Last active November 25, 2022 12:01
twitter autocomplete hack v2
//MIT license (ie. do whatever tf you want with this code)
//Paste directly into console or GreaseMonkey https://greasyfork.org/en/scripts/455318-twitter-from-ui-upgrade
let search;
let fromFlag = false;
setTimeout(() => {
search = document.querySelectorAll(
"input[placeholder='Search Twitter']"
)[0];