Skip to content

Instantly share code, notes, and snippets.

View imsmith's full-sized avatar

Ian Smith imsmith

  • Seattle
  • 18:15 (UTC -07:00)
View GitHub Profile
@haseeb5555
haseeb5555 / postDistribution.ts
Last active November 26, 2024 04:58
Fair Post Distribution Algorithm
import { PrismaClient, Prisma, DistributionStatus, UserRole } from '@prisma/client';
const prisma = new PrismaClient();
export class PostDistributionManager {
private distributionIntervals = [
1, // 1 day
3, // 3 day
7, // week
14,
@edwhad
edwhad / 1password_ssh_agent_wsl_multiple_github_accts.md
Last active November 23, 2024 22:10
How I configure multiple GitHub accounts using the 1password SSH agent (and working in WSL!)

How I use 1Password to manage SSH keys for multiple GitHub accounts (including on WSL)

If you don't care about why or how this works, you can skip right down to Setup Steps

A little bit of background

These are the considerations I tried to satisfy while researching this solution:

  1. I prefer not to generate new SSH keys for every machine/VM/environment where I use git or SSH. I end up with tons of keys per GitHub account or remote server, and I don't remember which is which.
  2. I want to keep private keys secured somewhere that is not directly accessible on the filesystem. Also try to avoid copying private keys around at all costs.
@Neophen
Neophen / README.md
Last active December 20, 2024 07:46
Better states, plugin for tailwind
#!/bin/sh
set -eu
TOKEN="$ROBOTS_TXT_TOKEN"
curl -vv \
-X "POST" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "@robots_body" \
@voodoohop
voodoohop / chatgpt_commit_messages.sh
Last active December 10, 2024 14:52
One-Liner Using ChatGPT for Concise, Automated Git Commit Messages
# install
pip install shell-gpt
sgpt "hi" (and enter your API key)
# commit the current folder with the generated message
git commit . -m "$(git diff | sgpt --model gpt-4o --code 'Write concise, informative commit messages: Start with a summary in imperative mood, explain the 'why' behind changes, keep the summary under 50 characters, use bullet points for multiple changes, avoid using the word refactor, instead explain what was done, and reference related issues or tickets. What you write will be passed to git commit -m "[message]"')"
# you could assign an alias now if you like it
@loreanvictor
loreanvictor / RISS.md
Last active October 29, 2024 07:50
Interaction as Content

Can We Get More Decentralised Than The Fediverse?

I guess that the [fediverse][fediverse] will be as decentralised as email: a bit, but not that much. Most people will be dependent on a few major hubs, some groups might have their own hubs (e.g. company email servers), personal instances will be pretty rare. This is in contrast to personal blogging, where every Bob can easily host their own (and they often do). I mean that's already implied by the name: fediverse is [a federated universe, not a distributed one][fed-v-dis].

Why does this matter? Well I like not being dependent on one entity, but I would like it much more if I was dependent on no entities at all. In other words, I like to publish my own personal blog and get all the goodies of a social network, without being dependent on other micro-blogging / social content platforms.

So in this writing, I'm going to:

  • ❓ Contemplate on why the fediverse gets federated not distributed (spoilers: its push vs pull)
  • 🧠 Ideate on how could we get a distri
@lelanthran
lelanthran / verbose_proxy.c
Last active June 5, 2024 16:02
A small program to proxy and record all traffic to a server.
/* ********************************************************
* Copyright ©2024 Rundata Systems. All rights reserved.
* This project is licensed under the GPLv3 License. You
* can find a copy of this license at:
* https://www.gnu.org/licenses/gpl-3.0.en.html
*
* More detail (1m read):
* https://www.rundata.co.za/rundata/products/verbose_proxy
*
* Example usage (3m video):
@searls
searls / github
Created November 16, 2023 02:11
I got sick of going through multiple steps to visit the current directory's github URL when I'm looking at a terminal, but I don't necessarily want to install `gh` or `hub` just for this feature.
#!/usr/bin/env ruby
begin
repo = `git remote -v`.split("\n").find { |line|
line.include?("github.com")
}.split("\t")[1].match(/[email protected]:(.*).git/)[1]
system "open https://github.com/#{repo}"
rescue
warn "No github remote found"
@quad
quad / 0-interceptors-are-functions-too.md
Last active April 10, 2024 09:06
Interceptors Are Functions Too

Interceptors Are Functions Too

I could not agree more with my colleague and friend Travis Johnson's opinion that "[INTERCEPTORS ARE SO COOL][iasc]!" In that post, he succinctly describes the [Interceptor pattern][pattern] as used adroitly by [OkHttp][okhttp]. But, as is often the case, I believe a complicated object-oriented pattern obscures the simple functional gem within it.

What is an Interceptor?

I'll quote liberally from [OkHttp's documentation on the topic][okhttp-interceptor]:

Interceptors are a powerful mechanism that can monitor, rewrite, and retry calls. […] >

@grdscrc
grdscrc / jazz.sh
Last active March 23, 2025 23:35
jazz : list paths from a json input, fuzzy search a node, get its content ; useful with large payloads
#!/usr/bin/env bash
# Tested with jq 1.6 & fzf 0.42.0
# Inspired by https://github.com/reegnz/jq-zsh-plugin
# Call with `jazz <big_file_with_many_paths>.json` or `<command producing a valid json> | jazz`
# End command with `... | pbcopy` or `... > output.json` to save selection
input=$1
TMP_DIR=$(mktemp -d /tmp/jazz_XXX)
chmod 700 "$TMP_DIR"