Skip to content

Instantly share code, notes, and snippets.

@Jerboa-app
Jerboa-app / git-staged-size.sh
Last active April 2, 2025 17:04
Show size of staged files in ascending order
git diff --name-only --cached --diff-filter=AM | xargs du -ch | sort -h
# https://stackoverflow.com/questions/5214625/how-to-find-out-the-space-requirements-of-files-to-be-committed
# https://stackoverflow.com/questions/33610682/git-list-of-staged-files/65785881
@Jerboa-app
Jerboa-app / README.md
Created June 4, 2024 19:54
Recieve to and send from a gmail alias like a workspace email for free...
  1. Setup email fowarding on squarespace (or other domain provider) from your_hidden_email@gmail.com to you@your.domain
  2. Create an app password in Google Account
  • This used to be in the Security/2-factor section but you must now follow this link https://myaccount.google.com/apppasswords [1]
  • Name it something memorable e.g. you@your.domain, and click create.
  • A password will be generated of the form qcxp lqyt qnsh jgqm, save it somewhere, safe, and click done. App passwords are a bit of a security risk!
  1. Go to gmail, click the cog (settings) and go to Accounts and Import, click Add another email address in the Send mail as: section
  2. In the popup enter the display name you want on the email alias, and you@your.domain as the email address
  3. Tick Treat as an alias. and then Next step.
  4. In SMTP Server put smtp.gmail.com.
  5. In Username put your_hidden_email@gmail.com
@Jerboa-app
Jerboa-app / git_commit_hours.sh
Created March 6, 2024 12:11
weekday hours for all git commits (reflog)
git log --reflog | grep -E "Mon|Tue|Wed|Thu|Fri" | grep -Eo " [0-9]{2}:" | sed s/://g > ~/weekday_hours
@Jerboa-app
Jerboa-app / signing_test.yml
Created January 26, 2024 14:49
GPG sign a file (detached) within a github action, using secrets
name: signing test
on:
workflow_dispatch:
jobs:
sign:
runs-on: ubuntu-20.04
steps:
@Jerboa-app
Jerboa-app / post_to_discord.rs
Last active January 4, 2024 14:05
MWE Post a given message to a Discord webhook, using rust with tokio-rs and reqwest-rs
/*
Cargo deps
tokio = { version = "1", features = ["full"] }
reqwest = { version = "0.11", features = ["json"] }
run as
```bash
@Jerboa-app
Jerboa-app / postToDiscordWebhook.sh
Created January 1, 2024 20:47
Post the string $1 to a discord webhook url $2
curl -i -H "Accept: application/json" -H "Content-Type:application/json" -X POST --data "{\"content\": \"$1\"}" $2
@Jerboa-app
Jerboa-app / convert_ma_result.jl
Created December 17, 2023 08:30
Generate a cpp function to return a string from an minaudio error code
# converts the miniaudio ma_result enum to string via Julia
# https://github.com/mackron/miniaudio/blob/master/extras/miniaudio_split/miniaudio.h#L432
# copy past the enum values into errors
# removing the comments, leaving just the entries.
# MA_SUCCESS = 0,
# MA_ERROR = -1,
# MA_INVALID_ARGS = -2,
# MA_INVALID_OPERATION = -3,
@Jerboa-app
Jerboa-app / wifi_qr_code.sh
Created November 30, 2023 21:21
generate qr code for wifi
qrencode -t PNG -o wifi.png "WIFI:S:$1;T:WPA;P:$2;;"
@Jerboa-app
Jerboa-app / zip_in_memory.rs
Last active November 28, 2023 21:24
Rust (libflate) compress and decompress string data in memory
use std::io::{Write, Read};
use libflate::deflate::{Encoder, Decoder};
const A_STRING: &str = "This is a string that can be compressed. This is a string that can be compressed. This is a string that can be compressed. This is a string that can be compressed.";
fn main() {
println!("The original data: {}\n", A_STRING);
let mut encoder = Encoder::new(Vec::new());