Skip to content

Instantly share code, notes, and snippets.

import requests, json
from datetime import datetime
# Get access token
r_token = requests.get("https://open.spotify.com/get_access_token?reason=transport&productType=web_player").json()
token = r_token["accessToken"]
token_expiration = datetime.fromtimestamp(r_token["accessTokenExpirationTimestampMs"] / 1000)
# Get album playcount
def get_playcount(album_id):
<html>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<body onload="CreateListReaderIframe()">
<script>
function CreateListReaderIframe() {
var ifr = document.createElement("iframe");
@byjg
byjg / NoVNC_Paste.js
Last active November 19, 2024 21:20
How to Paste code to NoVNC.
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
window.sendString = function (str) {
f(str.split(""));
function f(t) {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = character.match(/[A-Z!@#$%^&*()_+{}:\"<>?~|]/);
@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active January 6, 2025 13:09
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@mattiaslundberg
mattiaslundberg / arch-linux-install
Last active January 4, 2025 22:11
Minimal instructions for installing arch linux on an UEFI system with full system encryption using dm-crypt and luks
# Install ARCH Linux with encrypted file-system and UEFI
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# Download the archiso image from https://www.archlinux.org/
# Copy to a usb-drive
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration.
# Set swedish keymap
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active January 9, 2025 16:08
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'