Skip to content

Instantly share code, notes, and snippets.

View hansbickhofe's full-sized avatar

Hans Bickhofe hansbickhofe

View GitHub Profile
@guysmoilov
guysmoilov / Git pre-commit hook for large files.md
Last active February 14, 2024 23:46
Git pre-commit hook for large files

Git pre-commit hook for large files

This hook warns you before you accidentally commit large files to git. It's very hard to reverse such an accidental commit, so it's better to prevent it in advance.

Since you will likely want this script to run in all your git repos, a script is attached to add this hook to all git repos you create / clone in the future.

Of course, you can just download it directly to the hooks in an existing git repo.

If you find this script useful, you might enjoy our more heavy-duty project FastDS, which aims to make it easier to work with versioning in data science projects.

@ekreutz
ekreutz / ansible_variable_precedence.md
Last active April 25, 2024 17:43
Ansible variable precedence (order, hierarchy)
#### Contents of the preconfiguration file (for stretch)
### Localization
# Preseeding only locale sets language, country and locale.
#d-i debian-installer/locale string en_US
# The values can also be preseeded individually for greater flexibility.
d-i debian-installer/language string en
d-i debian-installer/country string DK
d-i debian-installer/locale string en_DK.UTF-8
# Optionally specify additional locales to be generated.
@vanjos
vanjos / NC-MySQLDUMP.sh
Last active January 2, 2023 00:15
Easy way to do a mysqldump and restore using netcat (this is NOT encrypted)
#####
# You'll be needing two machines, the target machine and source one (makes sense, right)?
#####
# On the target machine
nc -l 55555 | gzip -d -c | mysql <database name> -u<user> -p<password> [ | <decrypt> ]
#####
# On the source machine
mysqldump -u<user> -p<password> <database name> | gzip | nc <ip of target server> 55555 [ | <encrypt> ]
@earthgecko
earthgecko / bash.generate.random.alphanumeric.string.sh
Last active April 2, 2024 15:59
shell/bash generate random alphanumeric string
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-z0-9' | fold -w 32 | head -n 1