Skip to content

Instantly share code, notes, and snippets.

View lexisother's full-sized avatar
💻
school is literally permanently over. what.

Alyxia Sother lexisother

💻
school is literally permanently over. what.
View GitHub Profile
@lexisother
lexisother / archive-emotes.rb
Last active November 16, 2021 09:09 — forked from Mijyuoon/archive-emotes.rb
Discord emote archiving tool
#!/usr/bin/env ruby
AUTH_TOKEN = ENV["DISCORD_TOKEN"]
OUTPUT_DIR = "./emoji-archive"
SERVER_LIST = [
# List of server IDs here
]
require 'net/http'
@lexisother
lexisother / cc-mirror.zsh
Created December 24, 2021 13:28
Simple script to mirror sourcehut repos from @Cr3atable's sourcehut account to the @Cumcord org.
set -euo pipefail
BASE_DIR="$(dirname "$(readlink -f "$0")")"
MIRROR_DIR="$BASE_DIR/clone"
command_exists() { command -v "$1" &>/dev/null }
pprint() {
print -r -- "$(print -P '%F{8}==>%f') $1"
}
@lexisother
lexisother / imperial
Last active January 11, 2022 15:13
A simple tool to upload files to imperialb.in
#!/usr/bin/env bash
# TODO: Implement autodetection of the code language using Linguist
# The one reason I am slightly opposed to implementing this is because, well,
# it requires me to rely on an external tool. Usually I would not have many
# problems with this, but it's a shell script, I prefer to have it as
# self-contained as can be. See, if I were to use external tools to power the
# script such as Linguist, I might as well just write the thing in Ruby and
# call it a day.
@lexisother
lexisother / regedit.zsh
Last active January 12, 2022 21:47
Custom emote registry script
#!/usr/bin/env zsh
SCRIPT_PATH="${0:a:h}"
CONFIG_PATH="$HOME/.config/emote-regedit"
# Utility functions {{{
# Logging {{{
ansi_reset="$(tput sgr0 || true)"
ansi_red="$(tput setaf 1 || true)"
ansi_yellow="$(tput setaf 3 || true)"

Keybase proof

I hereby claim:

  • I am lexisother on github.
  • I am lexisother (https://keybase.io/lexisother) on keybase.
  • I have a public key ASBTrX7sHzICN_0oqBewCAFeLcAJ-MBMC4Rux3sotcm31Qo

To claim this, I am signing this object:

Instructions

Quick and dirty setup

# clone main repo and begin installing pkgs in the background
git clone https://github.com/dmitmel/crosscode-translateinator
cd crosscode-translateinator
pnpm i &
# clone the second repo and start building
@lexisother
lexisother / keep-rebase-date.md
Last active August 1, 2023 18:15
Reset commit metadata after rebasing

WARNING: ONLY DO THIS IN PERSONAL REPOSITORIES!!!

What I know now is that you can just use the --committer-date-is-author-date with a range of all dirty commits after a rebase session that reset a lot of dates.

The above seems to not always work. When in doubt:

git -c rebase.instructionFormat='%s%nexec GIT_COMMITTER_DATE="%cD" git commit --amend --no-edit --allow-empty --allow-empty-message' rebase -i HEAD~N
require "id3tag"
unless ARGV[0]
raise "No mp3 directory given!"
end
dir = ARGV[0]
unless dir.end_with? "/" then dir += "/" end
mp3s = Dir.glob(dir + "*.mp3")
(defun maxcount (nums)
(max (count-if (lambda (a) (< a 0)) nums)
(count-if (lambda (a) (> a 0)) nums)))
(print (maxcount '(1 2 3 4 5 6 -3 -5 7 -7)))
#!/usr/bin/env zsh
setopt ERR_EXIT ERR_RETURN NO_UNSET PIPE_FAIL
ansi_reset="$(tput sgr0 || true)"
ansi_red="$(tput setaf 1 || true)"
ansi_yellow="$(tput setaf 3 || true)"
ansi_blue="$(tput setaf 4 || true)"
log_info() { echo >&2 "${ansi_blue}[info]${ansi_reset}" "$@"; }
log_warn() { echo >&2 "${ansi_yellow}[warn]${ansi_reset}" "$@"; }