Skip to content

Instantly share code, notes, and snippets.

View petersandor's full-sized avatar

Peter Šándor petersandor

View GitHub Profile
@petersandor
petersandor / diff-jq.md
Created August 13, 2023 00:28 — forked from ipan/diff-jq.md
compare two JSONs with jq #json #jq

Keybase proof

I hereby claim:

  • I am petersandor on github.
  • I am psandor (https://keybase.io/psandor) on keybase.
  • I have a public key ASCz-TZRWzyJmzcxK2VxMAf20RJlHLTbcq-kQ3iTdGRYlgo

To claim this, I am signing this object:

const matrix = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
];
const rotateMatrix = (inputMatrix: Array<Array<Number>>, rotateBy: number) => {
let outputMatrix = new Array(inputMatrix.length).fill([]);
if (rotateBy === 0) {
@petersandor
petersandor / ca-blacklist.md
Last active November 14, 2016 10:27
CA blacklisting

FWIW, here's what I just did on my (Arch) Linux machine:

$ for f in /etc/ssl/certs/*.pem; do sudo ln -sfn "$f" /etc/ca-certificates/trust-source/blacklist/; done $ sudo update-ca-trust

This will block all currently installed CAs (as well as double-block some, but that doesn't really matter). You then need to add them back in.Restart your browser, and go to websites you access frequently (change them to https:// if necessary). Click the (broken) padlock and read off what CA they used; remove the corresponding .pem file from the blacklist directory. Some might be signed by intermediate certs and thus hard to find, but SSL Hopper has a great chain inspection tool at https://www.sslshopper.com/ssl-checker.html you can use to identify the topmost CA cert you need to whitelist.

After you're done, run sudo update-ca-trust again, and restart your browser. All normal sites should work, and you've gotten rid of ~160 root certs.

At host machine:
mkdir -p ~/.terminfo/r/
At client:
scp /usr/share/terminfo/r/rxvt-unicode-256color user@remotehost:.terminfo/r/
@petersandor
petersandor / spinal.js
Last active August 29, 2015 14:27
Spinal tap
function replacer(match) {
if(match.length === 2) {
return match.split('').join('-');
} else {
return '-';
}
}
function spinalCase(str) {
return str.replace(/[_ ]|[a-z][A-Z]/g, replacer).toLowerCase();