Skip to content

Instantly share code, notes, and snippets.

View hschne's full-sized avatar
🌞

Hans Schnedlitz hschne

🌞
View GitHub Profile
@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
@hschne
hschne / Kollegiale Hospitation.md
Created November 16, 2017 08:29
Beschreibung von ASE, Verlaufsplaung der zu hospitierende Sitzung etc.

Thema der LVA

Jour Fixe in Advanced Software Engineering.

Beschreibung der LVA

Advanced Software Engineering (ASE) hat das Ziel, Konzepte der Erstellung von Softwaresystemen anhand eines realer Projekts zu vertiefen. Dabei wird besonderer Wert auf die Erarbeitung von Entwicklungslösungen im Team gelegt. Fertigkeiten aus der LVA 'Software Engineering und Projektmanagement' (SEPM) werden vorrausgesetzt. Das Projektumfeld wird im Vergleich zu SEPM um fortgeschrittene Technologien und Anwendungsgebiete erweitert. Kurz gesagt entwickeln Studierende somit im Team ein neuartiges, technologisch anspruchsvolles Softwareprodukt.

Die Studierenden werden im Laufe des Semsters bei wöchentlichen Treffen (Jour Fixe) von ihrem Tutor / ihrer Tutorin betreut. Die Studierenden arbeiten prinzipiell in Gruppen von 5-6 Personen. In diesem speziellen Fall besteht die Gruppe allerdings nur aus drei Personen.