Skip to content

Instantly share code, notes, and snippets.

@santisbon
santisbon / Search my gists.md
Last active April 1, 2026 16:21
How to search gists.

Enter this in the search box along with your search terms:

Get all gists from the user santisbon.
user:santisbon

Find all gists with a .yml extension.
extension:yml

Find all gists with HTML files.
language:html

@santisbon
santisbon / Update-branch.md
Last active February 17, 2026 22:16
Deploying from Git branches adds flexibility. Bring your feature branch up to date with master and deploy it to make sure everything works. If everything looks good the branch can be merged. Otherwise, you can deploy your master branch to return production to its stable state.

Updating a feature branch

First we'll update your local master branch. Go to your local project and check out the branch you want to merge into (your local master branch)

$ git checkout master

Fetch the remote, bringing the branches and their commits from the remote repository. You can use the -p, --prune option to delete any remote-tracking references that no longer exist in the remote. Commits to master will be stored in a local branch, remotes/origin/master.

@santisbon
santisbon / nordvpn.sh
Last active January 24, 2026 16:37
Common NordVPN commands on Linux
nordvpn login
nordvpn account
nordvpn settings
nordvpn status
nordvpn set analytics off
nordvpn set killswitch on
nordvpn set autoconnect on
nordvpn set threatprotectionlite on
@santisbon
santisbon / XMLHttpRequestLoadImagePromise.js
Last active September 23, 2025 21:43
Using XMLHttpRequest to load an image in a javascript promise. Based on Mozilla Developer Network documentation.
/*jslint devel: true, browser: true, es5: true */
/*global Promise */
function imgLoad(url) {
'use strict';
// Create new promise with the Promise() constructor;
// This has as its argument a function with two parameters, resolve and reject
return new Promise(function (resolve, reject) {
// Standard XHR to load an image
var request = new XMLHttpRequest();
@santisbon
santisbon / Good taste.md
Last active August 27, 2025 19:38
What makes good taste? #linux #linus #torvalds

On Good Taste

Linus Torvalds in an interview talked about the idea of good taste in code or what I like to call elegance. As one might expect from two slides meant to make a point during a talk, he omits a lot of details to keep it short and simple. This post digs into the specifics of his example (deleting an element from a list) and adds another example (inserting an element in a list) including working code.

Example from Linus

This is an example of removing an element from a singly-linked list. It's one of the first data structures you learn about when you start learning about computer science and programming. The reason it doesn't show particularly good taste is because we have that condition at the end where we take a different action depending on whether the element we want to remove is at the beginning of the list or somewhere in the middle.

![Bad taste](http://

@santisbon
santisbon / bluesky-comments.tsx
Created November 25, 2024 06:20 — forked from emilyliu7321/bluesky-comments.tsx
Integrate Bluesky replies as your blog's comment section
"use client";
/* eslint-disable @next/next/no-img-element */
import Link from "next/link";
import { useState, useEffect } from 'react';
import {
AppBskyFeedDefs,
AppBskyFeedPost,
type AppBskyFeedGetPostThread,
} from "@atproto/api";
@santisbon
santisbon / sad-path.ts
Last active November 4, 2024 20:15 — forked from mozzius/sad-path.ts
Bluesky video upload - indirect upload. Sad path where you upload directly to your PDS. Takes a sec to process after posting.
import { AppBskyEmbedVideo, AtpAgent } from "npm:@atproto/api";
const userAgent = new AtpAgent({
service: prompt("Service URL (default: https://bsky.social):") ||
"https://bsky.social",
});
await userAgent.login({
identifier: prompt("Handle:")!,
password: prompt("Password:")!,
@santisbon
santisbon / latency.txt
Created October 27, 2024 20:52 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@santisbon
santisbon / happy-path.ts
Last active October 27, 2024 20:48 — forked from mozzius/happy-path.ts
Bluesky video upload - direct upload. Happy path, where you upload it directly to video.bsky.app.
import {
AppBskyEmbedVideo,
AppBskyVideoDefs,
AtpAgent,
BlobRef,
} from "npm:@atproto/api";
const userAgent = new AtpAgent({
service: prompt("Service URL (default: https://bsky.social):") ||
"https://bsky.social",
@santisbon
santisbon / Fedora.sh
Last active October 23, 2024 21:16
Fedora
sudo dnf up[grade]
# View repo list
dnf -v repolist --enabled [| grep Repo-baseurl]
# RPM Fusion repos (free and non-free)
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
# On Fedora, we default to use the openh264 library, so you need the repository to be explicitely enabled
sudo dnf config-manager --enable fedora-cisco-openh264