Skip to content

Instantly share code, notes, and snippets.


Giovanni Frigo GiovanniFrigo

View GitHub Profile
GiovanniFrigo / config\functions\config.json
Last active Jul 20, 2020
Random collection of strapi config files to try to solve the maxFileSize issue (filenames have reverse slash because gists filenames can't have slashes in their name)
View config\functions\config.json
"enabled": true,
"provider": "local",
"providerOptions": {
"sizeLimit": 10737418240
GiovanniFrigo / stillalive.rc
Last active Apr 12, 2019 — forked from rawdatalab/stillalive.rc
STILL ALIVE as a Bash script with beep (didn't create, just sharing) - sox version
View stillalive.rc
# Let 'em know that we're Still Alive
# (no longer valid)
# On macOS, install sox with brew: `brew install sox`
echo -n "This "
play --no-show-progress --null --channels 1 synth 0.200 sine 784
echo -n "was "
play --no-show-progress --null --channels 1 synth 0.200 sine 740
echo -n "a "
GiovanniFrigo / pruning merged remote
Last active Mar 3, 2020
Pruning merged branches on a git repository
View pruning merged remote

Pre: ensure you are on your main branch (usually master or devel) and that everything is up-to-date with your origin

git checkout master
git fetch

To list all the merged branches, use

GiovanniFrigo / breakSentenceAtPos.js
Created May 7, 2018
Simple function to break a sentence around a certain position without breaking the words (only at whitespaces)
View breakSentenceAtPos.js
function breakSentence(sentence, len) {
const r = new RegExp(`.{1,${len}}[^\\s]*`,'g');
let chunk;
let splitted = [];
while ((chunk = r.exec(sentence)) !== null) {
return splitted;
GiovanniFrigo / Execute this on
Last active Nov 12, 2018
Adding a new user to a Ubuntu/Debian server
View Execute this on
# Let' add Mario to the server
# Add the user with the interactive shell
adduser mario
# Check the creation of the user home directory
ls -al /home/mario/
# and set the default console to bash
chsh -s `which bash` mario
GiovanniFrigo / crontab configuration (`crontab -e`)
Last active Jan 19, 2019
Crontab configuration of my MBP. Let's add some small automation here!
View crontab configuration (`crontab -e`)
# Delete Screen Shots taken more than an hour ago. Keeps my Desktop clean :)
*/15 * * * * find $HOME/Desktop/Screen\ Shot*.png -mtime +1h -exec rm '{}' \; 2>/dev/null
*/15 * * * * find $HOME/Desktop/Screenshot*.png -mtime +1h -exec rm '{}' \; 2>/dev/null
GiovanniFrigo /
Last active Mar 30, 2016
Creates json files from each column of a given xlsx file
import openpyxl
except ImportError:
print ("openpyxl must be installed to run the script. [ pip install openpyxl ]")
from openpyxl import load_workbook
from openpyxl import workbook
import sys
from os import path, makedirs
GiovanniFrigo / .profile
Last active May 15, 2018
My own .profile file
View .profile
# Run source ~/.profile to make changes in this file effective
# alias ll, if not already present
alias ll='ls -lah'
# I like this colour schema for `ls`
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
GiovanniFrigo /
Created Nov 17, 2015
Generate html file from images in a directory (recursive)
from os import listdir, makedirs, path
from shutil import copy
f = open('output.html', 'w')
def process(directory):
if not directory.endswith( '/' ):
directory += "/"