Skip to content

Instantly share code, notes, and snippets.

View sts10's full-sized avatar

Sam Schlinkert sts10

View GitHub Profile
@sts10
sts10 / rust-command-line-utilities.markdown
Last active February 5, 2026 08:47
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
@sts10
sts10 / kitty.conf
Created January 16, 2020 20:24
My config file for Kitty Terminal Emulator
# vim:fileencoding=utf-8:ft=conf:foldmethod=marker
#: Fonts {{{
#: kitty has very powerful font management. You can configure
#: individual font faces and even specify special fonts for particular
#: characters.
font_family JetBrains Mono Medium
bold_font JetBrains Mono Bold
@sts10
sts10 / init.vim
Created January 7, 2020 14:54
One init.vim for both Mac and Linux
" call plug#begin('~/.vim/plugged')
call plug#begin('~/.config/nvim/plugged')
" Basics
Plug 'tpope/vim-commentary'
Plug 'sickill/vim-pasta'
Plug 'justinmk/vim-sneak'
Plug 'ervandew/supertab'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-repeat'
@sts10
sts10 / write_to.rs
Last active May 9, 2019 01:18
Rust script defining function that can write either to Terminal or a file
use std::fs::File;
use std::io::{self, Write};
#[derive(Debug)]
pub enum Destination<'a> {
Terminal,
File(&'a std::fs::File),
}
fn main() {
print_report(Destination::Terminal).expect("Error printing report to terminal");
@sts10
sts10 / playing-with-digits.rs
Created April 11, 2019 17:19
Playing with Digits kata
// https://www.codewars.com/kata/playing-with-digits/train/rust
// status: Getting a multiply overflow werror when I "Attempt"
fn dig_pow(n: i64, p: i32) -> i64 {
let digits: Vec<_> = n.to_string().chars().map(|d| d.to_digit(10).unwrap()).collect();
let mut sum: u64 = 0;
let mut i: u32 = 0;
for digit in digits {
@sts10
sts10 / alacritty.yml
Last active December 20, 2023 13:54
My Alacritty config yml for MacOS (compliant with v 0.4.1-dev)
# Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty it self.
env:
# TERM env customization.
#
# If this property is not set, alacritty will set it to xterm-256color.
#
@sts10
sts10 / day04.rs
Created December 5, 2018 14:25
my not-working day 4 part 1 solution (Advent of Code 2018)
use std::collections::HashMap;
use std::fs::File;
use std::io;
use std::io::BufRead;
use std::io::BufReader;
use std::str::FromStr;
fn main() {
let mut events_vec: Vec<String> = read_by_line("inputs/day04-test.txt").unwrap();
@sts10
sts10 / pyenv.markdown
Last active September 9, 2020 13:53
Installing and setting up a decent Python configuration in MacOS

Installing and setting up a decent Python configuration in MacOS 10.11

Before I took these steps, I ran brew uninstall python in an attempt to clear out a different Python installation. I also had to clear out some stuff in my .bash_profile.

  1. Install Pyenv via Homebrew: brew update && brew install pyenv
  2. Add necessary stuff to ~/.bash_profile: echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profile
  3. Restart terminal.
  4. Maybe install dependencies? (Thouhg you may be good to go already.)
  5. pyenv install --list and pick new-ish-but-stable versions of python2 and python3 to install. For example: pyenv install 3.7.0 2.7.15
  6. You can set version 3 as the global, with 2 as fall-back: pyenv global 3.7.0 2.7.15. You can also set your system's Python as a secondary fallback by running pyenv global 3.7.0 2.7.15 system.
@sts10
sts10 / masto_following_updater.rb
Last active October 25, 2018 17:44
A Ruby script that's (trying to) find moved accounts for you to follow
require 'mastodon'
require 'csv'
system("clear")
puts "Welcome to the Mastodon Following Updater!"
puts "\n"
puts "First, enter the URL of your home instance. For example, https://mastodon.social or https://octodon.social"
base_url = gets.chomp
system("clear")
@sts10
sts10 / yubikey-gpg-question.markdown
Last active February 8, 2018 17:44
Question about OpenPGP and YubiKey

Below is a step-by-step guide to test whether I could get a secret PGP key off of my YubiKey.

  1. On Computer 1, generate a GPG key pair.
  2. More your secret key to a YubiKey, following the instructions on this wedpage under "Generating the key on your local system"
  3. On computer 2, import the public key of the key pair.
  4. Still on computer 2, insert your YubiKey. Then create a stub for the secret key by running gpg --card-status source
  5. Unplug YubiKey.
  6. On computer 2, run gpg --export-secret-keys -a KEYID > secret.asc, filling in the KEYID with the key id.
  7. A private key is now in the file secret.asc