Skip to content

Instantly share code, notes, and snippets.

View rubenarakelyan's full-sized avatar
💾
Coding and reminiscing

Ruben Arakelyan rubenarakelyan

💾
Coding and reminiscing
View GitHub Profile
@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
Created March 18, 2024 14:38
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
@rubenarakelyan
rubenarakelyan / config.plist
Created October 21, 2023 19:57
Windows NT 4 VM on UTM/QEMU
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Backend</key>
<string>QEMU</string>
<key>ConfigurationVersion</key>
<integer>4</integer>
<key>Display</key>
<array>
@rubenarakelyan
rubenarakelyan / iptables.md
Created November 16, 2022 17:20
Lock down new server network
# Allow localhost traffic
iptables -A INPUT -i lo -j ACCEPT

# INVALID type packets should be DROPped regardless of source.
iptables -A INPUT -m state --state INVALID -j DROP

# Allow traffic for related/established connections already running
iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
@rubenarakelyan
rubenarakelyan / raspberrypi.md
Last active May 24, 2022 18:05
Remove unused software from new Raspberry Pi OS installation
sudo apt-get remove --purge bluej*
sudo apt-get remove --purge chromium*
sudo apt-get remove --purge libreoffice*
sudo apt-get remove --purge scratch*
sudo apt-get remove --purge vlc*
sudo apt-get remove --purge wolfram*
sudo apt-get clean
sudo apt-get autoremove
@rubenarakelyan
rubenarakelyan / postgresql.md
Created December 21, 2021 16:31
List of useful SQL commands for PostgreSQL

Disconnect all connected clients

SELECT pg_terminate_backend(pid)
FROM pg_stat_activity
WHERE datname = 'mydb';
@rubenarakelyan
rubenarakelyan / vscode-tasks.md
Created December 21, 2021 16:30
Instructions for quick tasks in Visual Studio Code

Copy search results to clipboard

  • CTRL + F
  • Type your search string
  • CTRL + SHIFT + L to select all occurrences found (max. 999)
  • ESC (or close search dialog with top-right X)
  • CTRL + I to select whole lines
  • CTRL + C
  • Open new file
  • CTRL + V