Skip to content

Instantly share code, notes, and snippets.

View valerio-bozzolan's full-sized avatar
🕯️
Currently praying the parser/compiler

Valerio Bozzolan valerio-bozzolan

🕯️
Currently praying the parser/compiler
View GitHub Profile
@valerio-bozzolan
valerio-bozzolan / add-user-with-ssh-key.sh
Last active February 2, 2022 10:31
Add Unix user with only SSH key (without password)
#!/bin/sh
#
# License: CC0
# Author: Valerio Bozzolan
# https://gist.github.com/valerio-bozzolan/70e0184478fa0ffa52a37745ac04f333
#
# Quickly create an user without password but with an SSH key
#
USERNAME="$1"
Categories:
- Navigation
License: GPL-3.0-or-later
AuthorName: Ferdinando Traversa
AuthorEmail: ferdi.traversa@gmail.com
WebSite: https://cerca.wikilovesmonuments.it
SourceCode: https://github.com/ferdi2005/monumenti
IssueTracker: https://github.com/ferdi2005/monumenti/issues
AntiFeatures:
- Tracking
@valerio-bozzolan
valerio-bozzolan / fix-composer.patch
Created June 21, 2021 21:35
Fix Composer 1.8.* GitHub token parser
103,105c103,105
< if (!preg_match('{^[.a-z0-9]+$}', $token)) {
< throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
< }
---
> // if (!preg_match('{^[.a-z0-9]+$}', $token)) {
> // throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
> //
@valerio-bozzolan
valerio-bozzolan / autossh.service
Last active May 12, 2020 13:06 — forked from thomasfr/autossh.service
Systemd service for autossh
[Unit]
Description=Keeps a tunnel to 'remote.example.com' open
After=network.target
[Service]
User=autossh
# -p [PORT]
# -l [user]
# -M 0 --> no monitoring
# -N Just open the connection and do nothing (not interactive)
@valerio-bozzolan
valerio-bozzolan / wikidata_query.sparql
Last active November 6, 2018 18:20
Elenco dei comuni italiani da Wikidata
# http://tinyurl.com/y8xefcy9
#
# Comuni d'Italia con coordinate, codice ISTAT e codice Wikidata
# Author: Valerio Bozzolan
# Date: 6 novembre 2018
# Query license: public domain
# Original query: https://gist.github.com/valerio-bozzolan/b12b0625619f257b58dabefa1474b7f4
#defaultView:Map
SELECT
( SAMPLE( ?regioneLabel ) AS ?regioneLabel )
@valerio-bozzolan
valerio-bozzolan / Wordpress Debian SMTP Adapter
Last active October 20, 2016 10:19
Why incorporate other-people SMTP code when you have PEAR installed via package manager? Add this as a plugin.
<?php
/*
Plugin Name: Debianatore Mailoso di Valerio
Plugin URI: https://wordpress.org/support/topic/the-e-mail-could-not-be-sent/#post-179327
Description: Send SMTP mails with an include "Net/SMTP.php";... simple! #nocrap
Author: Valerio Bozzolan
Author URI: https://boz.reyboz.it
Version: 0000000.0.0.-1.0
License: GPLv3 or later
*/
@valerio-bozzolan
valerio-bozzolan / regrep.sh
Last active May 4, 2020 19:21
Match parentesis subexpressions like `grep -E` (egrep) actually don't. In pure GNU Bash and no other dependency.
#!/bin/bash
########################################
# Match regex grep -E
# License: GNU GPL v3+
# Author: Valerio Bozzolan
########################################
function rtfm {
if [ ! -z "$2" ]; then
echo "Error: $2."
@valerio-bozzolan
valerio-bozzolan / mysql.sh
Last active July 26, 2020 16:25
Debian GNU/Linux MySQL-MariaDB autologin
#!/bin/bash
########################################
# MySQL | MariaDB autologin
########################################
# Put in your .bashrc
alias mysql='mysql --defaults-file=/etc/mysql/debian.cnf'
alias mysqldump='mysqldump --defaults-file=/etc/mysql/debian.cnf'