Skip to content

Instantly share code, notes, and snippets.

View bisignam's full-sized avatar
🌈

Mario Bisignani bisignam

🌈
  • Migros Online / Search Team
  • Zürich, Switzerland
View GitHub Profile
@bisignam
bisignam / cleanup.sh
Last active May 26, 2021 12:06
Delete files older than a given date in the current directory (depth 1)
find . -maxdepth 1 -type f '!' -newermt '2020-12-31' -print0 | xargs -0 rm
cat gun_to_change.csv | awk -F ',' '{print "update t_company set gun_number = \x27"$3"\x27 where gun_number = \x27"$2"\x27;" }'
@bisignam
bisignam / cleanup_dirs.sh
Created January 2, 2020 08:50
Bash: remove directories older than X days
find . -mtime +10 -type d -exec rm -rf {} \;
@bisignam
bisignam / remove_non_printable_characters.sh
Created October 3, 2019 07:04
Remove non printable characters from file
sed $'s/[^[:print:]\t]//g' FR_TH01HOTE_201909271427.sql
@bisignam
bisignam / gist:a204907f3488abbfe15ddf4ef8e2ffa2
Created October 3, 2019 07:04
Split a file in 6 (N) parts by maintaing suffix a file extension
split -n6 FR_TH01HOTE_201909271427_clean.sql FR_TH01HOTE_201909271427_clean FR_TH01HOTE_201909271427_clean --additional-suffix=.sql
@bisignam
bisignam / add CA cert on CentOS Debian Ubuntu.md
Created September 13, 2019 10:47 — forked from kekru/add CA cert on CentOS Debian Ubuntu.md
Add CA cert to local trust store on CentOS, Debian or Ubuntu
  • Open a webpage that uses the CA with Firefox
  • Click the lock-icon in the addressbar -> show information -> show certificate
  • the certificate viewer will open
  • click details and choose the certificate of the certificate-chain, you want to import to CentOS
  • click "Export..." and save it as .crt file
  • Copy the .crt file to /etc/pki/ca-trust/source/anchors on your CentOS machine
  • run update-ca-trust extract
  • test it with wget https://thewebsite.org
@bisignam
bisignam / grep_special_chars
Created May 29, 2019 07:12
Match special characters using egrep
egrep '^.*?[#~%@¢?^$£§¬¼¿½¤]+.*?$' file.txt
@bisignam
bisignam / gist:a6f8b84a15d9d4436063b1d5239e6476
Created February 20, 2019 09:01
Git Delete branch local and remote
git branch -d feature/login
git push origin --delete feature/login
@bisignam
bisignam / find_largest_tables.sql
Created October 17, 2018 16:14
Find largest tables in database
SELECT CONCAT(table_schema, '.', table_name),
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
ROUND(index_length / data_length, 2) idxfrac
FROM information_schema.TABLES
ORDER BY data_length + index_length DESC;
@bisignam
bisignam / debug_requests.py
Created October 16, 2018 08:31 — forked from Daenyth/debug_requests.py
Enable debug logging for python requests
import requests
import logging
import httplib
# Debug logging
httplib.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
req_log = logging.getLogger('requests.packages.urllib3')
req_log.setLevel(logging.DEBUG)