Skip to content

Instantly share code, notes, and snippets.

@belkarx
belkarx / lemonbar.sh
Created July 22, 2022 20:42
lemonbar.sh
#!/usr/bin/bash
Clock(){
TIME=$(date "+%H:%M:%S")
echo -e -n " \uf017 ${TIME}"
}
Cal() {
DATE=$(date +"%Y/%m/%d [%a]")
@belkarx
belkarx / Hacker News x LessWrong
Last active December 3, 2022 03:54
Correlates LessWrong usernames to Hacker News usernames (25% of active LW users, n=355, are also on Hacker News)
import json
import requests
d = # grab data from here: https://www.lesswrong.com/graphiql?query=%20%20%20%20%7B%0A%20%20%20%20%20%20posts%28input%3A%20%7B%0A%20%20%20%20%20%20%20%20terms%3A%20%7B%0A%20%20%20%20%20%20%20%20%20%20view%3A%20%22new%22%0A%20%20%20%20%20%20%20%20%20%20limit%3A%2050000%0A%20%20%20%20%20%20%20%20%20%20meta%3A%20null%20%20%23%20this%20seems%20to%20get%20both%20meta%20and%20non-meta%20posts%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%29%20%7B%0A%20%20%20%20%20%20%20%20results%20%7B%0A%20%20%20%20%20%20%20%20%20%20user%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20username%0A%20%20%20%20%20%20%20%20%20%20%20%20slug%0A%20%20%20%20%20%20%20%20%20%20%20%20displayName%0A%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D
xx = json.loads(d)
aa = []
count = 0
@belkarx
belkarx / MVP relative pitch testing.mat
Created December 22, 2022 19:45
MVP relative pitch testing.mat
t = linspace(0, 1, 14400);
scale = [261.63 293.66 329.63 349.23 392.00 440 493.88 523.25];
strs = ["C", "D", "E", "F", "G", "A", "B", "C2"];
r = rand(1, 20)
for i = 1:length(scale)
f = scale(i);
strs(i)
sound(sin((2*pi*f)*t), 14400);
@belkarx
belkarx / doing.py
Created February 8, 2023 05:24
Text box that pops up and logs user input to file
import tkinter as tk
from datetime import datetime
timestamp = datetime.now().strftime("%m-%d %H:%M:%S")
f = open("doinglog.txt", "a")
def submit_text(event=None):
@belkarx
belkarx / flameshot.sh
Last active February 8, 2023 23:32
flameshot x tesseract
#!/bin/bash
# `flameshot config` and change the default save name (in General) to "scrot_tmp"
# add to .xbindkeysrc (make sure xbindkeys is installed and running):
# "/bin/bash /home/uk000/flameshot.sh"
# Mod1 + s
# Mod1 is the alt key, `xbindkeys -k` to figure out the names of other special keys
# install tesseract (there may be a step where a corpus must be manually installed)
@belkarx
belkarx / get_cards.sh
Created February 11, 2023 04:41
Get Quizlet Cards
wget $MY_URL --referer "google.com" --user-agent="Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36"
cat index.html | grep -Po "window\.Quizlet\[\"MiniFlashcards\"\].*QLoad\(\"Quizlet\.MiniFlashcards\"\)" > json_object
# Python to parse json object
import json
data = open("json_object", "r").read()
json.loads(data[35:-33])
In case anyone is wondering and has to look this up and script it like I did, # of upvotes by frequency of upvote score is a logarithmic relationship
@belkarx
belkarx / openai_PHQ_single.py
Created June 28, 2023 03:45
Script to test responses to PCQ-9 questions
import openai
import os
import json
from tqdm import tqdm
#change this!
TEMPERATURE=1
#past work: https://twitter.com/colin_fraser/status/1636755134679224320
@belkarx
belkarx / wayback.js
Created September 25, 2023 20:25
wayback machine bookmarklet / chatgpt
javascript: (function() {
var currentUrl = window.location.href;
var apiUrl = "https://archive.org/wayback/available?url=" + encodeURIComponent(currentUrl);
console.log("Sending GET request to:", apiUrl);
fetch(apiUrl).then(response => {
console.log("Received response:", response);
return response.json();
}).then(data => {
console.log("Received data:", data);
var archivedUrl = data["archived_snapshots"]["closest"]["url"];
@belkarx
belkarx / speed.js
Created September 27, 2023 06:52
speed.js
javascript:document.querySelector('video').playbackRate=3