Skip to content

Instantly share code, notes, and snippets.

View skounis's full-sized avatar

Stavros Kounis skounis

View GitHub Profile
@skounis
skounis / remove-icon.sh
Last active March 18, 2024 13:41
Remove Icon file in MacOS recursively
#!/bin/bash
find . -name "Icon?" -print0 | xargs -0 rm -rf
@skounis
skounis / dump-nocache.sh
Last active November 14, 2023 14:09
Dump Drupal DB without cache tables with drush
# Without cache
drush sql-dump --structure-tables-list=cache,cache_* > dumpfile.sql
# Without cache, search index and watchdog
drush sql-dump --structure-tables-list=cache,cache_*,search_index,watchdog > dumpfile.sql
# Without table spaces
drush sql-dump --structure-tables-list=cache,cache_*,search_index,watchdog --extra-dump="--no-tablespaces --column-statistics=0 --set-gtid-purged=OFF" > db.sql
@skounis
skounis / preprocess_links__language_block.php
Last active September 11, 2023 12:54
Drupal - Preprocess language links
@skounis
skounis / docker-cleanup.sh
Created January 2, 2020 08:56
Stop and Remove all Docker containers. Clean up
docker container stop $(docker container ls -aq)
docker container rm $(docker container ls -aq)
docker system prune --volumes
@skounis
skounis / install-ubuntu-2204-wsl2.bat
Last active October 20, 2022 12:24
WSL2 Install Ubuntu with Text User Interface
:: Download Ubuntu 22.04 from Microsoft Store
:: Launch Ubuntu 22.04. The Ubuntu installation GUI window will be black. Close it.
:: Open PowerShell and start the setup in TUI mode
sl --shutdown
wsl --unregister Ubuntu-22.04
ubuntu2204.exe --ui=tui
:: See
:: https://github.com/microsoft/WSL/issues/8525
@skounis
skounis / getandverify.sh
Created July 28, 2022 07:22
Download and verify the EU DCC Trustlist
#! /bin/bash
# Download trustlist, signature and certificate
wget https://ec.europa.eu/assets/eu-dcc/dcc_trustlist.zip
wget https://ec.europa.eu/assets/eu-dcc/dcc_trustlist.zip.sig.txt
wget https://ec.europa.eu/assets/eu-dcc/eu_signer.pem.txt
# Convert the signature file from base64 encoded to plain DER file
openssl base64 -a -A -d -in dcc_trustlist.zip.sig.txt -out dcc_trustlist.zip.sig.der
# Verify the integrity
openssl cms -verify -in dcc_trustlist.zip.sig.der -inform DER -content dcc_trustlist.zip -binary -CAfile eu_signer.pem.txt --out /dev/null
@skounis
skounis / nuke-git.sh
Last active April 5, 2022 07:35
Remove a file from Git's history
# Download bfg for
# https://rtyley.github.io/bfg-repo-cleaner/
java -jar bfg.jar --delete-files {filename}
git push --force
@skounis
skounis / open-edge.bat
Last active March 28, 2022 14:31
Open Edge with disabled security
"c:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" --disable-web-security --disable-gpu --user-data-dir=c:/tmp/chromeTemp
@skounis
skounis / 7za.sh
Last active March 15, 2022 06:33
Create a AES256 encrypted .zip file with 7 zip
# Encrypt and zip
7za a -tzip -pMY_SECRET -mem=AES256 secure.zip doc.pdf doc2.pdf doc3.pdf
# Decrypt and unzip
7za e secure.zip
@skounis
skounis / cache-remove.sh
Created March 14, 2022 12:14
Git ignore and remove files from the history (cached)
# List all the ignored files previously commited
git ls-files -ci --exclude-standard
# Remove file from Git's history. It keeps it in the file system
git rm --cached path/to/file
# Remove all the ignored files
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached