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 / 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 / codesign.md
Created November 20, 2024 20:35
Code signing apps in macOS without a developer account

Create a self-signed certificate:

  1. Open Keychain Access.
  2. Choose Keychain Access > Certificate Assistant > Create Certificate ...
  3. Enter a name 4.Set 'Certificate Type' to 'Code Signing'

Then, your command should look like this, if your certificate name is my-new-cert:

codesign -fs my-new-cert /Applications/Utilities/Boot\ Camp\ Assistant.app

@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 / rails.sh
Created July 5, 2024 15:03
Create a new Rails app with PostgreSQL, ESBuild and Tailwind CSS
gem install pg -- --with-pg-include=/opt/homebrew/opt/libpq/include --with-pg-lib=/opt/homebrew/opt/libpq/lib
bundle exec rails new . -n app_name -d postgresql -j esbuild -c tailwind
@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 October 1, 2024 20:06
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]