Skip to content

Instantly share code, notes, and snippets.

View yhanini's full-sized avatar

Yassine HANINI yhanini

View GitHub Profile
@yhanini
yhanini / gist:cf908a3c4619c9911d3abd284f5ee18e
Last active January 28, 2026 15:26
scrapper ibexa storage
#!/bin/bash
# Configuration
DOMAINE="https://exemple.com/" # /!\ N'oublie pas le / à la fin
FICHIER_LISTE="liste.txt"
# Vérifier si le fichier liste existe
if [ ! -f "$FICHIER_LISTE" ]; then
echo "Erreur : $FICHIER_LISTE introuvable."
exit 1
@yhanini
yhanini / drop_tables.sh
Created February 14, 2020 13:37
Delete all tables from a database
#!/bin/bash
MHOST="$1"
MUSER="$2"
MPASS="$3"
MDB="$4"
# Detect paths
MYSQL=$(which mysql)
AWK=$(which awk)
GREP=$(which grep)
@yhanini
yhanini / mysql-docker.sh
Created December 4, 2019 13:52 — forked from nshtg/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE > backup.sql
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | gzip > backup.sql.gz
docker exec CONTAINER /usr/bin/mysqldump -u root -pPASSWORD DATABASE | bzip2 > backup.sql.bz2
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
gunzip < backup.sql.gz | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
bunzip2 < backup.sql.bz2 | docker exec -i CONTAINER /usr/bin/mysql -u root -pPASSWORD DATABASE
@yhanini
yhanini / wordpress.vcl
Created May 22, 2018 15:03 — forked from matthewjackowski/wordpress.vcl
Varnish 4 VCL configuration for WordPress. Also allows purging
# A heavily customized VCL to support WordPress
# Some items of note:
# Supports https
# Supports admin cookies for wp-admin
# Caches everything
# Support for custom error html page
vcl 4.0;
import directors;
import std;
@yhanini
yhanini / backup-databases.sh
Created January 29, 2018 09:05
Backup all mysql databases;
#!/bin/bash
USER="root"
PASSWORD=""
#OUTPUT="/Users/rabino/DBs"
#rm "$OUTPUTDIR/*gz" > /dev/null 2>&1
databases=`mysql -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`
* Bash and scripting :
Text to ASCII Art Generator : http://patorjk.com/software/taag/#p=display&f=Graffiti&t=Type%20Something%20
@yhanini
yhanini / parameters_countrieslocations.yml
Last active September 30, 2016 14:52
YML file of latitude/longitude by country's code ISO
parameters:
# source: https://developers.google.com/public-data/docs/canonical/countries_csv
matching.country.isocode.location:
# Andorra
AD:
lat: 42.546245
lng: 1.601554
# United Arab Emirates
AE:
lat: 23.424076