Skip to content

Instantly share code, notes, and snippets.

View cdeath's full-sized avatar

Nuno Pereira cdeath

View GitHub Profile
@cdeath
cdeath / password-generator.md
Last active March 10, 2024 13:57
password generator

Password (Re)Generator

TL;DR; A keyed-hash string encoding function.
Useful for setting strong passwords that you will not remember but can regenerate.

Use any hash function you like.

HMAC with BASE64 (no special chars)

echo -n "username" | openssl sha256 -hmac "password" | cut -d " " -f 2 | base64 | cut -c 1-64
@cdeath
cdeath / macos_stuff.md
Created July 27, 2022 02:42
macOS stuff

macOS stuff

set/change/disable firmware password

sudo firmwarepasswd -setpasswd
sudo firmwarepasswd -check
sudo firmwarepasswd -verify
sudo firmwarepasswd -delete
@cdeath
cdeath / euromillions.js
Last active January 30, 2024 17:49
euromillions code golf
/*
* euromillions generator code golf. unique numbers. in javascript. because.
* change the parameters for games other than euromillions.
* paste the code in the browser console and press enter.
*/
// non "RFC compliant" version (does not allow collisions between numbers and stars)
for(a=[],r=_=>Math.ceil(Math.random()*(i<5?50:12)),i=0;i<7;i++){n=r();while(a.includes(n))n=r();a[i]=n};a;
// zero fucks given (globals, no sorting)
@cdeath
cdeath / force_incognito.md
Last active July 27, 2022 02:45
always open chrome in incognito

Force Incognito on Chromium based browsers

Chrome

defaults write com.google.Chrome IncognitoModeAvailability -integer 2
defaults delete com.google.Chrome IncognitoModeAvailability

Brave

@cdeath
cdeath / konmari.md
Last active October 8, 2023 14:33
keep your mac updated and clean

Tidying up your mac

softwareupdate

softwareupdate -i -a --force --agree-to-license
sudo softwareupdate -i -a -R --force --agree-to-license

homebrew

@cdeath
cdeath / bashing.md
Last active October 26, 2020 12:27
bashing

Command line stuff

find (and optionally delete) files or folders

mdfind ''
find . -name ''
find . -iname ''
find . -name '' -type f -delete
find . -name '' -type d -delete
@cdeath
cdeath / ffmpeg_mkv_ops.md
Last active October 2, 2024 19:25
extract stuff from .mkv with ffmpeg