Skip to content

Instantly share code, notes, and snippets.

View cristiroma's full-sized avatar

Cristian Romanescu cristiroma

View GitHub Profile
@cristiroma
cristiroma / my.cnf
Last active July 9, 2023 18:56
MySQL configuration for local development
[mysqld]
character-set-server=utf8mb4
slow_query_log=1
slow_query_log_file=/var/log/mysql/slow.log
net_read_timeout=7200
net_write_timeout=7200
table_definition_cache=16384
open_files_limit=32768
thread_cache_size=256
max_connections=10
@cristiroma
cristiroma / etc--sudoers.d--development
Created July 7, 2023 14:04
sudo configuration for PHP developers
# Allow any user to restart apache without password
ALL ALL = NOPASSWD:/usr/bin/systemctl restart apache2
ALL ALL = NOPASSWD:/usr/bin/systemctl restart nginx
Cmnd_Alias PHP = /usr/bin/update-alternatives --config php, /usr/bin/update-alternatives --set php /usr/bin/php5.6, /usr/bin/update-alternatives --set php-config /usr/bin/php-config5.6, /usr/bin/update-alternatives --set phpize /usr/bin/phpize5.6, /usr/bin/update-alternatives --set php /usr/bin/php7.4, /usr/bin/update-alternatives --set php-config /usr/bin/php-config7.4, /usr/bin/update-alternatives --set phpize /usr/bin/phpize7.4, /usr/bin/update-alternatives --set php /usr/bin/php7.1, /usr/bin/update-alternatives --set php-config /usr/bin/php-config7.1, /usr/bin/update-alternatives --set phpize /usr/bin/phpize7.1, /usr/bin/update-alternatives --set php /usr/bin/php7.4, /usr/bin/update-alternatives --set php-config /usr/bin/php-config7.4, /usr/bin/update-alternatives --set phpize /usr/bin/phpize7.4, /usr/bin/update-alternatives --set php /usr/bin/
@cristiroma
cristiroma / safenet-5110.md
Last active January 26, 2023 21:09
Install SafeNet 5110 on Linux Mint 21.1 / Ubuntu 22.04
  1. Download the SafeNet Authentication Client 10.8 (mine was 10.8.28) from https://knowledge.digicert.com/generalinformation/INFO1982.html
  2. Download libssl1.1_1.1.1f-1ubuntu2_amd64.deb from http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
  3. Install libssl1.1 - dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
  4. Install safenetauthenticationclient_10.8.28_amd64.deb from Standard folder (with UI) - dpkg -i safenetauthenticationclient_10.8.28_amd64.deb
  5. Install opensc - apt install opensc
  6. Enable pcscd service - sudo systemctl enable pcscd; sudo systemctl start pcscd
  7. Insert token and check status - pkcs11-tool --modul /usr/lib/libeTPkcs11.so --show-info -v
Cryptoki version 2.20
@cristiroma
cristiroma / gist:1a5314abfaa7cc6ec64f3796cb01882f
Created February 7, 2022 16:35
MariaDB performance problem for queries with a lot of tables
optimizer_search_depth = 0
@cristiroma
cristiroma / postfix-smart-host-zoho.md
Last active February 11, 2022 19:33
Setup a local Ubuntu 20.04 smart host to relay emails over zoho SMTP server
./vendor/bin/drush sql:dump --structure-tables-list=cache,cache_*,watchdog,sessions,history --result-file database.sql --gzip
@cristiroma
cristiroma / drupal-delete-taxonomy-subtree.php
Last active November 14, 2021 09:29
Drush script to delete a subtree of a taxonomy in Drupal 8+
<?php
/* Root term not deleted */
$exit = 0;
$vid = $extra[0];
if (empty($vid)) {
$exit = 1;
}
$parent = $extra[1];
@cristiroma
cristiroma / cron.sh
Last active November 17, 2020 16:58
Drush CRON
# Run every hour at :15 and :45
15,45 * * * * apache /var/www/html/web/vendor/bin/drush --uri=https://example.com cron
# Run every 5 minutes and suppress output
*/5 * * * * apache /var/www/html/web/vendor/bin/drush --uri=https://example.com cron > /dev/null 2>&1
@cristiroma
cristiroma / wget.sh
Created October 28, 2020 07:42
wget commands
# Spider through website up to level 5 links
wget --no-verbose --recursive --spider --force-html --level=5 --no-directories --reject=jpg,jpeg,png,gif,pdf,doc,docx http://example.com
@cristiroma
cristiroma / rsync.sh
Created June 16, 2020 13:55
RSYNC 101
# Sync only images
rsync -ravz --progress --include="*/" --include="*/*.jpg" --include="*/*.jpeg" --include="*/*.png" --include="*/*.gif" --include="*/*.svg" --exclude="*" user@server.com:/path/to/folder/ .