Skip to content

Instantly share code, notes, and snippets.

View alanwsmith's full-sized avatar

Alan Smith alanwsmith

View GitHub Profile
/posts/20elg89zsnmm--first-post--yeah-yeah /posts/first-post-yeah-yeah--20elg89zsnmm 301
/20elg89zsnmm /posts/first-post-yeah-yeah--20elg89zsnmm 301
/posts/20elg89zsnmm /posts/first-post-yeah-yeah--20elg89zsnmm 301
/first-post-yeah-yeah /posts/first-post-yeah-yeah--20elg89zsnmm 301
/posts/20elgdcxpbhk--jack-as-jake /posts/jack-as-jake--20elgdcxpbhk 301
/20elgdcxpbhk /posts/jack-as-jake--20elgdcxpbhk 301
/posts/20elgdcxpbhk /posts/jack-as-jake--20elgdcxpbhk 301
/jack-as-jake /posts/jack-as-jake--20elgdcxpbhk 301
/posts/20elgjxncy8k--yahoo-music-unlimited--still-very-beta /posts/yahoo-music-unlimited-still-very-beta--20elgjxncy8k 301
/20elgjxncy8k /posts/yahoo-music-unlimited-still-very-beta--20elgjxncy8k 301
"Agnes",
"Albert",
"Alex",
"Alice",
"Alva",
"Amelie",
"Anna",
"Bad News",
"Bahh",
"Bells",
@alanwsmith
alanwsmith / main.sh
Created May 18, 2023 22:28 — forked from pojntfx/main.sh
Bluesky/AT Protocol: cURL API Interaction Cheatsheet
#!/bin/bash
# This script resolves a DID, retrieves an API key, fetches a user's feed,
# and posts a "Hello, world" message to the user's feed.
# Resolve DID for handle
HANDLE='felicitas.pojtinger.com'
DID_URL="https://bsky.social/xrpc/com.atproto.identity.resolveHandle"
export DID=$(curl -G \
--data-urlencode "handle=$HANDLE" \
@alanwsmith
alanwsmith / permutation_attempt.py
Created November 16, 2022 16:23
This was an attempt at finding permutations for an array/list. It works for 4 items, but that's it. Next stop: Heap's algorithm
def perms(data):
return_data = []
counter = 1
for x in range(1, len(data) + 1):
counter *= x
shapes = [
[0, 1, 2, 3],
[0, 1, 3, 2],
[0, 2, 1, 3],
[0, 2, 3, 1],
<!DOCTYPE html>
<html>
<head>
<script>
const theDivs = [
{
id: 'id1',
},
{
id: 'id2',
#!/usr/bin/env python3
stuff = {
"x": 10,
"y": 10
}
sinput = "x == y"
parts = sinput.split(" == ")
@alanwsmith
alanwsmith / i-do-not-get-it.js
Created November 26, 2021 23:21
Trying to figure out why https calls happen together at the end instead of interspersed
// The code below will output:
//
// Getting: https://www.example.com/
// Getting: https://www.example.org/
// Getting: https://www.example.net/
// 200
// 200
// 200
//
// Given that there's a 5 second delay between https
@alanwsmith
alanwsmith / preview_file.lua
Created June 11, 2021 21:36
Is this a safe way to preview files in Neovim with a Lua plugin? Is there a better way?
local search_buffer, search_window
local document_buffer, document_window
local storage_dir = "/Users/alans/Desktop/neovim-test-files/"
local function open_file()
local file_name = vim.api.nvim_buf_get_lines(search_buffer, 0, 1, true)
-- I do scrubbing to make sure the file is valid but
-- have removed it to focus on the preview part of the example
local file_path = storage_dir..'/'..file_name[1]
vim.api.nvim_set_current_win(document_window)
@alanwsmith
alanwsmith / gist:c72539123bc8009f85d56147b0cead85
Created May 1, 2021 18:45
working on twixel cleanup with PIL
from PIL import Image
with Image.open('image-2021-05-01T13-10-39-0400.png') as im:
img = Image.new('RGB', (1000, 1000), color = 'white')
px = im.load()
for x in range(301, 309):
for y in range(61, 67):
@alanwsmith
alanwsmith / gist:a908202622af3ec3bfd8f3148af6179c
Created April 30, 2021 02:35
Basic Twitch EventSub Server Example
import json
import os
from flask import Flask, request, Response
app = Flask(__name__)
@app.route('/webhooks/twitch-callback', methods=['POST'])
def respond():