Skip to content

Instantly share code, notes, and snippets.

View hschne's full-sized avatar
⛰️

Hans Schnedlitz hschne

⛰️
View GitHub Profile
@hschne
hschne / tokyo-night.toml
Created April 2, 2025 07:50
Tokyo Night Theme for Atuin
# Drop this into ~/.config/atuin/themes/tokyo-night.toml, then reference it in atuin.conf
#
# See https://docs.atuin.sh/guide/theming/
[theme]
name = "tokyo-night"
parent = "default"
[colors]
AlertInfo = "#73daca"
AlertWarn = "#e0af68"
@hschne
hschne / rate_limit.rb
Created January 11, 2024 17:02
Leaky Bucket Rate Limiter in Ruby
frozen_string_literal: true
# A leaky bucket rate limiter for Ruby
#
# @see https://www.mikeperham.com/2020/11/09/the-leaky-bucket-rate-limiter/
# @see https://en.wikipedia.org/wiki/Leaky_bucket
class RateLimit
class Error < StandardError
attr_accessor :retry_in
@hschne
hschne / follow.rb
Created August 28, 2023 18:52
It Follows...
require 'httparty'
def fetch(url)
response = HTTParty.get(url)
response.parsed_response
end
# Setting content type didn't work 😢
def to_json_request(url)
url.gsub('challenge', 'challenge.json')

2021 Retrospective

Based on An End of the Year Retrospective by Pat Kua.

What happened during your year?

Go through your planning tools (e.g. personal and work calendars, to-do lists, journals, etc) and list any events or activities (by month) of significance to you. Capture these as if you were a neutral bystander.

Examples might include: “Moved house”, “Took part in a virtual panel”, or “Read Lord of the Rings for the 2nd time”

#!/usr/bin/env bash
# Add drop shadows to any pictures in the current folder
for file in *.png
do
convert $file \( +clone -background black -shadow 50x10+5+5 \) +swap -background none -layers merge +repage "$file"_shadow.png
done
@hschne
hschne / Readme.md
Last active January 4, 2021 14:22
RCF

RuboCop Fix

This script runs Rubocop auto-correction on all files that were changed in the current branch.

Getting Started

Copy the script below to somewhere on your path (e.g. /usr/local/bin), then make the file executable and run it.

# In a directory in your path
@hschne
hschne / Setup.md
Last active May 12, 2023 10:34
Local Setup in Markdown

Setting up Arch

Installation

Setup

Basics

sudo pacman -Sy --noconfirm base-devel git curl openssh inetutils
@hschne
hschne / .aliases
Last active August 26, 2020 12:34
Zapier CLI Aliases
alias zd="zapier describe"
alias ze="zapier env"
alias zeg="zapier env:get"
alias zes="zapier env:set"
alias zhist="zapier history"
alias zp="zapier push"
alias zpro="zapier promote"
alias zt="zapier test"
alias zua="zapier users:add"
alias zul="zapier users:links"
@hschne
hschne / extract.sh
Created March 28, 2019 21:23
Extract Files from Subfolders
#!/usr/bin/env bash
# This script extracts all files with the given name from directories within the current one
# into the given directory, while attaching identifiers to the extracted files.
#
# A file 'Testfile.txt' will be extracted from some folder 'Name_Number_Something/subfolder/asubfolder/' to
# the folder 'out' by executing
#
# ./extract Testfile.txt out
#
@hschne
hschne / packaging-libvips-on-ubuntu.md
Last active September 3, 2019 13:44 — forked from renexu/build_libvips.md
Packaging Vips on Ubuntu 18.04

These are the steps to build latest libvips (8.7.4) deb package on Ubuntu 18.04.

Getting set up

Install the build dependencies.

sudo apt install build-essential devscripts