Skip to content

Instantly share code, notes, and snippets.

View rubenarakelyan's full-sized avatar
💾
Debugging and re-bugging

Ruben Arakelyan rubenarakelyan

💾
Debugging and re-bugging
View GitHub Profile
@rubenarakelyan
rubenarakelyan / gist:c212a75045f9f407c89c8a23c685fb48
Created February 20, 2026 15:25
Delete all merged Git branches
git branch --merged origin/main | grep -vE "^\s*(\*|main|develop)" | xargs -n 1 git branch -d
@rubenarakelyan
rubenarakelyan / gnupg-wkd.md
Created November 26, 2024 15:06
Generate and upload a web key directory version of your GPG key
mkdir -m 750 WKD-PATH
gpg-wks-server --directory WKD-PATH --install-key KEY-ID EMAIL-ADDRESS
Upload to https://example.com/.well-known/openpgpkey/
@rubenarakelyan
rubenarakelyan / next_day.rb
Created October 30, 2024 11:34
Get next day of the week
DAYS = %w[Sunday Monday Tuesday Wednesday Thursday Friday Saturday].freeze
def next_day(current_day)
DAYS.at((DAYS.find_index(current_day) + 1) % DAYS.length)
end
@rubenarakelyan
rubenarakelyan / serverpush.pl
Created October 17, 2024 09:22
Server-push animation
#!/usr/bin/perl
use strict;
use warning;
use GD;
$images = "/path/to/images";
$header = "Content-type: multipart/x-mixed-replace; boundary=ddc072ce-3b52-4704-9fef-abf661a13d43\n";
$boundary = "\n--ddc072ce-3b52-4704-9fef-abf661a13d43\n";
$giftype = "Content-type: image/gif\n\n";
@rubenarakelyan
rubenarakelyan / delete-docker-build-cache
Created July 29, 2024 15:10
Delete Docker build cache
docker builder prune
@rubenarakelyan
rubenarakelyan / csp-hash.js
Created April 6, 2024 20:49
Calculate the CSP hash of a script in the browser console
const scripts = document.getElementsByTagName("script"),
script_content = scripts[scripts.length - 1].innerHTML,
enc = new TextEncoder(),
data = enc.encode(script_content);
crypto.subtle.digest('SHA-256', data).then(function(val) {
const digest = ["sha256", _arrayBufferToBase64(val)].join("-");
console.log(`The digest for your script is: ${digest}`);
});
@rubenarakelyan
rubenarakelyan / win95.conf
Last active May 3, 2026 12:14
DOSBox-X config for Windows 95
[sdl]
autolock=true
[dosbox]
title=Windows 95
memsize=256
captures=capture
[video]
vmemsize=8
@rubenarakelyan
rubenarakelyan / win98.conf
Created February 20, 2024 20:23
DOSBox-X config for Windows 98
[sdl]
autolock=true
[dosbox]
title=Windows 98
memsize=256
captures=capture
[video]
vmemsize=8
@rubenarakelyan
rubenarakelyan / wfw311.conf
Created February 19, 2024 20:31
DOSBox-X config for Windows for Workgroups 3.11
[sdl]
autolock=true
mouse emulation=integration
[dosbox]
title=Windows for Workgroups 3.11
memsize=256
captures=capture
[dos]
@rubenarakelyan
rubenarakelyan / change-macos-password.md
Created December 27, 2023 19:09
Change macOS password in single user mode

Change macOS password in single user mode

  1. Hold ⌘+S on startup
  2. mount -uw / (fsck -fy is not needed)
  3. launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist (or /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist in 10.6)
  4. dscl . passwd /Users/username (without a trailing slash) and enter a new password. You can ignore the error about com.apple.DirectoryServices.plist.
  5. reboot