Skip to content

Instantly share code, notes, and snippets.

View imsmith's full-sized avatar

Ian Smith imsmith

  • Seattle
  • 12:15 (UTC -07:00)
View GitHub Profile
voodoohop /
Last active May 22, 2024 12:10
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 /
Last active March 16, 2024 09:32
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 / verbose_proxy.c
Last active April 8, 2024 17:08
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:
* More detail (1m read):
* Example usage (3m video):
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
repo = `git remote -v`.split("\n").find { |line|
system "open{repo}"
warn "No github remote found"
quad /
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 /
Last active November 17, 2023 00:32
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
# 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
TMP_DIR=$(mktemp -d /tmp/jazz_XXX)
chmod 700 "$TMP_DIR"
guest271314 /
Created September 10, 2023 15:53
Creating a FIFO-type file stream pipe between the browser and local applications

Today we are going to create a FIFO (First In First Out) type file stream between the browser and a local application.

The idea is to create a local file in the browser, when the file is created the local application writes data to the newly created file, in the browser we will read the data written to the file up to that point, then truncate the file to size 0, repeat, when the writing and reading of the file are complete we will remove the file from the local file system.

In this way we can configure our local application to watch for the creation of specific named files, each performing a discrete process, and stream data from the local application to the file, without using networking.

We'll be using Deno in this example for the local application. Use whatever local application you want. Node.js, QuickJS, C,

evadne /
Last active October 4, 2023 23:24
How to Sell Elixir (2023)

How to Sell Elixir AGAIN (2023)

Presented by Evadne Wu at Code BEAM Lite in Stockholm, Sweden on 12 May 2023


We have celebrated 10 years of Elixir and also nearly 25 years of Erlang since the open source release in December 1998.

Most of the libraries that were needed to make the ecosystem viable have been built, talks given, books written, conferences held and training sessions provided. A new generation of companies have been built on top of the Elixir / Erlang ecosystem. In all measures, we have achieved further reach and maturity than 5 years ago.

ScottKillen / print.css
Last active May 15, 2024 15:33
PDF export stylesheet for obsidian
/* Obsidian snippet to style output of pdf exports
@media print {
/* set your preferred fonts here.
:root {
--body-font-family: "Newsreader Text", TimesNewRoman, "Times New Roman", Times, Baskerville, Georgia, serif;
idlehands /
Last active May 20, 2023 11:28
-info and links