Skip to content

Instantly share code, notes, and snippets.

@hfreire
hfreire / limego-consent-all.js
Created November 2, 2018 08:10
🎃 Hack 🤘 to consent ✉️ e-mail and data processing for 🤷🏼‍♂️ contact persons in 📚 Lime Go CRM https://www.lime-go.se
@hfreire
hfreire / wakeonlan_qnap_nas.sh
Last active January 19, 2019 11:04
Wake-on-LAN (WoL) QNAP NAS from OSX
curl -O https://raw.githubusercontent.com/jpoliv/wakeonlan/master/wakeonlan
perl wakeonlan 24:5E:BE:00:00:00
@hfreire
hfreire / git_commit_12_hours_ago.sh
Created January 19, 2019 11:08
Do a git commit 12 hours ago
GIT_AUTHOR_DATE=$(date -v '-12H' '+%a %h %d %H:%M:%S %Y %z') \
GIT_COMMITTER_DATE=$(date -v '-12H' '+%a %h %d %H:%M:%S %Y %z') \
git commit -am "feat: better late than ever"
@hfreire
hfreire / generate_secure_password.sh
Last active July 11, 2019 15:01
Generate a secure 32 char password with user random seed
apg -n 1 -MCLN -m 32 -s
@hfreire
hfreire / shrink_ext3_partition.md
Last active January 19, 2019 19:03
Shrink an ext3 partition on a SD card in OSX
Unmount disk
sudo diskutil unmount /dev/disk2
Check partition status
sudo e2fsck -f /dev/disk2s3
@hfreire
hfreire / base64uuid.java
Created May 8, 2019 10:12
A Base64 UUID encoder/decoder optimised for encoding and decoding UUID hashes in only 22 characters (instead of 36)
import java.nio.ByteBuffer;
import java.util.Base64;
import java.util.UUID;
public class base64uuid {
private static final Base64.Encoder BASE64_URL_ENCODER = Base64.getUrlEncoder().withoutPadding();
public static void main(String[] args) {
try {
if (args.length < 2) {
@hfreire
hfreire / ban_unban_ip_fail2ban.md
Last active May 10, 2019 09:34
Ban/unban an IP address from Fail2ban

Ban IP address 1.1.1.1 jailed within ssh

fail2ban-client set dovecot banip 1.1.1.1

Unban IP address 1.1.1.1 jailed within ssh

fail2ban-client set dovecot unbanip 1.1.1.1
@hfreire
hfreire / brute_forcing_imap_passwords.md
Created May 10, 2019 09:39
Brute forcing IMAP passwords
nmap -p143,993 --script imap-brute localhost
@hfreire
hfreire / bash_startup_load_order.txt
Last active March 25, 2024 20:22
bash startup load order
If you have ever put something in a file like .bashrc and had it not work, or are
confused by why there are so many different files — .bashrc, .bash_profile, .bash_login,
.profile etc. — and what they do, this is for you.
The issue is that Bash sources from a different file based on what kind of shell it thinks
it is in. For an “interactive non-login shell”, it reads .bashrc, but for an “interactive
login shell” it reads from the first of .bash_profile, .bash_login and .profile (only).
There is no sane reason why this should be so; it’s just historical. Follows in more detail.
For Bash, they work as follows. Read down the appropriate column. Executes A, then B, then C,
etc. The B1, B2, B3 means it executes only the first of those files found.
@hfreire
hfreire / zsh_startup_load_order.txt
Created December 10, 2019 09:08
zsh startup load order
+----------------+-----------+-----------+------+
| |Interactive|Interactive|Script|
| |login |non-login | |
+----------------+-----------+-----------+------+
|/etc/zshenv | A | A | A |
+----------------+-----------+-----------+------+
|~/.zshenv | B | B | B |
+----------------+-----------+-----------+------+
|/etc/zprofile | C | | |
+----------------+-----------+-----------+------+