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 / 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 / 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 / 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 / Workspace.code-workspace
Last active January 1, 2023 11:10
Visual Studio Code workspace settings
{
"folders": [],
"settings": {
"diffEditor.ignoreTrimWhitespace": false,
"editor.acceptSuggestionOnEnter": "off",
"editor.bracketPairColorization.enabled": true,
"editor.emptySelectionClipboard": false,
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.rulers": [80],
@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 / bash-scripts.md
Last active March 31, 2022 12:22
List of useful mini bash scripts

Find files from a list

while read -r file
do
  find . -name "$file"
done < list.txt

Convert JSON to CSV