Skip to content

Instantly share code, notes, and snippets.

View hschne's full-sized avatar
⛰️

Hans Schnedlitz hschne

⛰️
View GitHub Profile
@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 / 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
#!/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

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”

@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')
@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 / 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"