Skip to content

Instantly share code, notes, and snippets.

@henri
henri / ruby-negative-space.ruby
Created October 1, 2025 21:25
negative space programming example snippits
def calculate_area(width, height)
raise TypeError, "Width must be a number" unless width.is_a?(Numeric)
raise TypeError, "Height must be a number" unless height.is_a?(Numeric)
raise ArgumentError, "Width must be positive" unless width > 0
raise ArgumentError, "Height must be positive" unless height > 0
width * height
end
@henri
henri / 001.browsers_cheatsheet.md
Last active September 30, 2025 22:12
browsers cheatsheet (many different browsers)

Browser Cheatsheets

This set of cheat sheets is designed to assist you with using various browsers. Little tips and trickes may not know and which I will not remember. Leave a comment or start a discussion if you have something good to add to the list.

Links

@henri
henri / memory_monitor.bash
Created September 12, 2025 00:31
memory_monitor.bash
#!/usr/bin/env bash
# memory monitor script
# Henri Shustak
# (C) 2022 GNU GPL v3 or later
# basic path setup (good for most systems)
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
# settings (this could be improved to use percentages)...
@henri
henri / rsync_wrapper_vanished_files.bash
Last active October 24, 2025 08:24
rsync vanished files removal wrapper
#!/bin/bash
rsync "$@" 2> >(grep -v vanished)
ret=$?
((ret==24)) && exit 0 || exit $ret
@henri
henri / convert_mkv_tree.bash
Last active October 24, 2025 08:32
convert mkv files into mp4 files (probably into lower quaility)
#!/bin/bash
#(C) Henri Shustak 2000
# Released Under the GNU GPLv3 or later
# https://www.gnu.org/licenses/gpl.html
# This script will batch process mkv files (or something else if you modify) and use handbreak (or something else)
# in order to reduce the quaility or convert the format. It will work on these files sequentially and
# keep tabs. If you need to carry on beyond restarts, then it would pay to alter the log file location
# so it is not deleted between reboots.
@henri
henri / 0001.crontab-dump.bash
Created August 5, 2025 02:29
crontab cheat sheet
#!/bin/bash
#
# (C)2020 Henri Shustak
# Released Under the MIT Licence
# https://mit-license.org/
#
# dump the crontab
user_name=$(whoami)
host_name=$(hostname)
@henri
henri / 000.tar_cheat_sheet.txt
Last active August 6, 2025 03:09
tar cheatsheet
# create a compressed archive from a number of sources
tar -czf compressed-archive.tar.gz /srv/source1 /srv/source2 # ...
# list all .txt files in archive (better if you are hunting into large archives)
tar -tf archive.tar --wildcards '*.txt'
tar -tzf archive.tar.gz --wildcards '*.txt'
# it is possible to use third party tools to mount or explore a compressed tar archive
# eg :
# - https://github.com/mxmlnkn/ratarmount
@henri
henri / gist:e91dcde274cea0c584a73f9dc22b115f
Created July 16, 2025 02:24 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue:
@henri
henri / await.sh
Created July 16, 2025 02:14 — forked from zzak/await.sh
Script to wait for localhost service in bash, with retries
#!/usr/bin/env bash
set -euo pipefail
TRIES=0
until [ $TRIES -eq 10 ] || nc -z localhost 3000; do
sleep 0.1
TRIES=$(( TRIES+1 ))
done
require 'csv'
require 'open-uri'
file = "Workbook3.csv"
content = CSV.read(open(file), encoding: 'ISO-8859-1:UTF-8', col_sep: ";")
File.open("output.csv", "w") do |f|
rows = content.map { |row| "\"#{row.join('","')}\"" }.join("\n")
f.puts(rows)