Skip to content

Instantly share code, notes, and snippets.

@mricon
mricon / my-gen-msgid.sh
Last active December 14, 2023 19:23
my-gen-msgid
#!/bin/bash
# This generates lore-friendly message-id headers that are safe, unique, and
# provide better UX for someone using lore to retrieve messages.
#
# Instructions for using with mutt/neomutt:
#
# Save this as ~/bin/my-gen-msgid, then add ~/.mutt-fix-msgid with the following,
# fixing your path to the file:
#
# my_hdr Message-ID: <`/home/user/bin/my-gen-msgid`>
@kflu
kflu / fb_get_token.py
Created January 14, 2023 09:21
Obtain a Facebook Access Token
#!/usr/bin/env python3
"""Obtain a Facebook Access Token
From: https://github.com/dequis/purple-facebook/issues/445#issuecomment-967542766
Changes:
- Ported to Python3
- Auto generate the MACHINE_ID UUID
- Can set EMAIL from environment variable
@vvb2060
vvb2060 / am_proc_start.cpp
Created July 19, 2022 17:12
monitor app process start
#include <unistd.h>
#include <string>
#include <cinttypes>
#include <android/log.h>
#include <sys/system_properties.h>
using namespace std;
extern "C" {
@InternetUnexplorer
InternetUnexplorer / command-not-found.sh
Last active March 17, 2024 11:53
Improved home-manager nix-locate configuration, with an auto-updated index and a better command-not-found handler
# Adapted from https://github.com/bennofs/nix-index/blob/master/command-not-found.sh
command_not_found_handle () {
if [ -n "${MC_SID-}" ] || ! [ -t 1 ]; then
>&2 echo "$1: command not found"
return 127
fi
echo -n "searching nix-index..."
ATTRS=$(@nix-locate@ --minimal --no-group --type x --type s --top-level --whole-name --at-root "/bin/$1")
@agnostic-apollo
agnostic-apollo / Android-Phantom,Cached-And-Empty-Processes.md
Last active February 23, 2025 01:52
Android Phantom, Cached And Empty Processes
@stranger-danger-zamu
stranger-danger-zamu / convert_flac_for_usb.sh
Created November 7, 2021 19:33
Parallel convert FLAC files to MP3 with `fd` or `find`
#!/usr/bin/env bash
ffmepg -i "${1}" -ab 320k -map_metadata 0 -id3v2_version 3 "${2}"
kid3-cli -c 'fromtag "%{artist} - %{album} - %{track}. %{title}" 2' "${2}"
@abalta
abalta / Cryptography.kt
Last active July 20, 2023 00:24
AndroidKeystore Kotlin Usage
package com.marsathletic.android.macfit.app.base
import android.security.keystore.KeyGenParameterSpec
import android.security.keystore.KeyProperties
import android.util.Base64
import java.io.IOException
import java.nio.charset.StandardCharsets
import java.security.*
import java.security.cert.CertificateException
import javax.crypto.*
@dianoetic
dianoetic / README.md
Last active July 14, 2023 01:32
A GitHub Action for sending webmentions after your site builds

Send Webmentions with GitHub Actions

Action that uses curl to send your webmentions. It gets the most recent addition to a JSON feed (ideally, your latest post), looks for the value of a key called uri (ideally, your post's permalink) and sends webmentions for it.

The services currently in the file are webmention.app and brid.gy, but any service that can be triggered with a POST request will work fine with this.

This workflow file is run once another GitHub Action named "Build" completes successfully.

Usage

@roalcantara
roalcantara / 0_tldr.zsh
Last active February 18, 2025 02:02
Glob (globbing)
## TL;DR
setopt extendedglob
ls *(<tab> # to get help regarding globbing
rm ../debianpackage(.) # remove files only
ls -d *(/) # list directories only
ls /etc/*(@) # list symlinks only
ls -l *.(png|jpg|gif) # list pictures only
ls *(*) # list executables only
ls /etc/**/zsh # which directories contain 'zsh'?
@chrisanthropic
chrisanthropic / nixos-raspi4.md
Last active August 14, 2024 17:01
NixOS + Raspi4

Download the image builder

  • git clone [email protected]:Robertof/nixos-docker-sd-image-builder.git
  • cd nixos-docker-sd-image-builder

Configure for Raspi4

  • modify /config/rpi4/default.nix to increase size of boot partition
    • this step is optional but I ran out of space in /boot pretty quickly with the default setting since I'm still learning and rebuilding a lot. Let's leave some room for trial & error.
    • sdImage.firmwareSize = 1024;
  • modify /config/sd-image.nix
  • ./rpi3 becomes ./rpi4