Skip to content

Instantly share code, notes, and snippets.

View dentarg's full-sized avatar
🌦️
=:D><!

Patrik Ragnarsson dentarg

🌦️
=:D><!
View GitHub Profile
@dentarg
dentarg / split-pem
Created September 11, 2023 10:42
Ruby script to split certificate files (.pem)
#!/usr/bin/env ruby
require "openssl"
BEGIN_CERT = "-----BEGIN CERTIFICATE-----"
END_CERT = "-----END CERTIFICATE-----"
def debug(str)
return unless ENV.key?("DEBUG")
puts "[DEBUG] #{str}"
$ docker run --rm -it ruby:3.2.2 bash
Unable to find image 'ruby:3.2.2' locally
3.2.2: Pulling from library/ruby
918547b94326: Pull complete
5d79063a01c5: Pull complete
4eedd9c5abf7: Pull complete
9cdadd40055f: Pull complete
199731bb2986: Pull complete
dcf5010fd812: Pull complete
a6cfe86a8ac7: Pull complete
@dentarg
dentarg / fly.bash
Last active September 27, 2022 19:02
TLS fail with Fly.io, why?
$ host debug.fly.dev
debug.fly.dev has address 188.93.151.254
debug.fly.dev has IPv6 address 2a09:8280:1:763f:8bdd:34d1:c624:78cd
$ curl -o /dev/null -s -v --http1.1 --header 'Host: debug.fly.dev' https://188.93.151.254
* Trying 188.93.151.254:443...
* Connected to 188.93.151.254 (188.93.151.254) port 443 (#0)
* ALPN: offers http/1.1
} [5 bytes data]
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
@dentarg
dentarg / .zshenv
Last active October 26, 2022 18:38
How to Ruby on Apple silicon
# Need to use ~/.zshenv, ~/.zprofile is not sourced when doing "arch -x86_64 /bin/zsh"
#
# From 'man zsh' (zsh 5.8.1 (x86_64-apple-darwin21.0))
#
# Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login
# shell, commands are read from /etc/zprofile and then $ZDOTDIR/.zprofile.
# Then, if the shell is interactive, commands are read from /etc/zshrc and
# then $ZDOTDIR/.zshrc. Finally, if the shell is a login shell,
# /etc/zlogin and $ZDOTDIR/.zlogin are read.

Keybase proof

I hereby claim:

  • I am dentarg on github.
  • I am dentarg (https://keybase.io/dentarg) on keybase.
  • I have a public key ASDKRPMUvU-funhmDWaukmlmEcJ_koiqO3UC5m6MirIFlQo

To claim this, I am signing this object:

@dentarg
dentarg / nm.txt
Created March 15, 2022 10:47
macOS man pages
NM(1) General Commands Manual NM(1)
NAME
nm - display name list (symbol table)
SYNOPSIS
llvm-nm [ -agnoprumxjlPA ] [ - ] [ -t format ] [[ -arch arch_flag ]...] [
file ... ] [ -s segname sectname ]
@dentarg
dentarg / close_notifications_applescript.js
Created February 11, 2022 13:36 — forked from lancethomps/close_notifications_applescript.js
AppleScript to close all notifications on macOS Big Sur
function run(input, parameters) {
const appName = "";
const verbose = true;
const scriptName = "close_notifications_applescript";
const CLEAR_ALL_ACTION = "Clear All";
const CLEAR_ALL_ACTION_TOP = "Clear";
const CLOSE_ACTION = "Close";
#!/usr/bin/env ruby
if %w(-h --help).include?(ARGV.first)
abort <<~USAGE
#{__FILE__} <FILE> to count IPs in given file
#{__FILE__} to count IPs using latest file on disk
DL=1 #{__FILE__} to download the AWS IP ranges
USAGE
end
@dentarg
dentarg / heroku-ci-sample-timings-and-cost.md
Created December 11, 2021 12:43 — forked from jasonrudolph/heroku-ci-sample-timings-and-cost.md
Sample timings and costs using various Heroku CI dyno types

Sample timings (in seconds)

Sample timings using Heroku CI for a small-ish Rails 6 app on various Heroku dyno types:

Dyno Type Run 1 Duration Run 2 Duration Run 3 Duration Average Duration
standard-1x 312 213 303 276
standard-2x 227 121 222 190
performance-m 162 164 175 167
performance-l 100 104 107 104