Skip to content

Instantly share code, notes, and snippets.

@sts10
sts10 / rust-command-line-utilities.markdown
Last active May 4, 2024 23:11
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
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)
@Falkor
Falkor / git-crypt-rm-gpg-user.sh
Last active February 27, 2024 16:31 — forked from glogiotatidis/remove-gpg-user.sh
Git-crypt remove user.
#!/usr/bin/env bash
#
# Script to remove GPG user (recipient) with git-crypt
#
# It will re-initialize git-crypt for the repository and re-add all keys except
# the one requested for removal.
#
# Note: You still need to change all your secrets to fully protect yourself.
# Removing a user will prevent them from reading future changes but they will
# still have a copy of the data up to the point of their removal.
@s8sg
s8sg / NetworkingFirecracker.md
Last active May 4, 2024 18:51
Networking with Firecracker

Create Bridge interface on the host and give internet access

sudo ip link add name br0 type bridge
sudo ip addr add 172.20.0.1/24 dev br0
sudo ip link set dev br0 up
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables --table nat --append POSTROUTING --out-interface enp3s0 -j MASQUERADE
sudo iptables --insert FORWARD --in-interface br0 -j ACCEPT

Create a tap device and link to the bridge

@thaJeztah
thaJeztah / a-do-a-run-run-a-do-a-run.md
Last active March 5, 2024 14:32
Silly experiments with `RUN --mount`

Silly experiments with RUN --mount

relates to moby/moby#32507, moby/buildkit#442

Doing some silly experimenting with RUN --mount:

# syntax=docker/dockerfile:1

FROM alpine AS stage1
@res0nat0r
res0nat0r / jq.md
Last active December 19, 2020 00:06
Useful JQ Examples
@mochja
mochja / spread.sh
Created March 3, 2016 11:48
Spread changes to last file modification
#!/bin/bash
for f in $(git status --porcelain); do
if [ -f "$f" ]; then
hash=$(git log -n1 --pretty=%H "$f")
if [ ! -z "$hash" ]; then
git add "$f" && git commit --fixup "$hash"
fi;
fi
done
@CMCDragonkai
CMCDragonkai / create_sparse_file.sh
Last active April 21, 2023 03:52
CLI: Creating Sparse Files (Can be used for virtual loopback block devices)
#!/usr/bin/env bash
# seems to work on any filesystem
# final size is (bs * seek) in bytes
# this creates a 4MB sparse file
dd if=/dev/zero of=/tmp/file bs=1 count=0 seek=4194304
# or
@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 4, 2024 09:43
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@hvrauhal
hvrauhal / README.md
Last active May 23, 2022 05:51
Aggressively caching squid for http://registry.npmjs.org/

Caching http://registry.npmjs.org/ aggressively with squid

We run a lot of project in our automated test environment and they spend a lot of time doing npm install. One way to speed up npm install and hammer the registry a little less is to use the http-version of the registry and to pass the requests through a proxy.

However, the npm requests include an authorization-header and the responses come with an ETag and Cache-Control: max-age=60, so with default squid settings there is a lot of roundtrips to registry.npmjs.org that result in 304's.

This is what the requests look like once npm has cached the first set of responses:

GET http://registry.npmjs.org/sntp HTTP/1.1