Skip to content

Instantly share code, notes, and snippets.

View roberto-butti's full-sized avatar
🚀

Roberto Butti roberto-butti

🚀
View GitHub Profile
@roberto-butti
roberto-butti / merge_image.sh
Created January 15, 2016 15:21
Script per la sovrapposazione di N immagini con trasparenza
COUNTER=1
for currentfile in $(ls Productname*.png); do
if [ $COUNTER == 1 ]; then
cp $currentfile prova_$COUNTER.png
else
composite $currentfile prova_$(expr $COUNTER - 1).png prova_$COUNTER.png
fi
COUNTER=$(expr $COUNTER + 1)
done
@roberto-butti
roberto-butti / stats_2016_01.json
Last active February 2, 2016 19:53
Statistiche utilizzo Browser gennaio 2016
{
"Chrome 47.0": "23.69",
"Chrome for Android": "16.39",
"Safari iPhone": "7.03",
"IE 11.0": "6.23",
"Firefox 43.0": "5.76",
"Android 0": "4.83",
"Opera 0": "4.04",
"Safari iPad": "3.22",
"Chrome 48.0": "2.41",
@roberto-butti
roberto-butti / merge_image_multilayer.sh
Created February 12, 2016 10:03
How to flat N png images (with trasparency) in 1 layer in jpg format (with 50% quality) #imagemagick #confert #flatten
convert images_*.png -layers flatten image.png ; convert image.png -quality 50 image.jpg
@roberto-butti
roberto-butti / send_curl_json_post_auth.php
Last active February 22, 2016 10:40
Send a JSON in a POST, with HTTP Basic Auth
<?php
$endpoint_url="your_url_here";
$string_json = "your_json_string";
$username="username";
$password ="password";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $endpoint_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
@roberto-butti
roberto-butti / send_json_post_auth_with_guzzle.php
Created February 22, 2016 11:35
Send a JSON in a POST, with HTTP Basic Auth (Guzzle Version)
<?php
$endpoint_url="your_url_here";
$string_json = "your_json_string";
$username="username";
$password ="password";
$client = new Client();
$options= array(
'auth' => [
$username,
@roberto-butti
roberto-butti / .htaccess
Created March 3, 2016 15:50
.htaccess for mod_expires and mod_deflate
<IfModule mod_expires.c>
ExpiresActive on
# Your document html
ExpiresByType text/html "access plus 1 month"
# Media: images, video, audio
ExpiresByType audio/ogg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
@roberto-butti
roberto-butti / update loc (lng lat) on mongodb.js
Last active September 23, 2016 16:54
update loc (lng lat) on mongodb
db.tollbooth.find().forEach(function (item) {
loc = [item.lng, item.lat]
// print(loc)
item.loc= loc
print(item)
db.tollbooth.save(item)
})
db.tollbooth.find().forEach(function (item) {
name = item.name
mysplit = name.split(" - ")
item.route = mysplit[0]
db.tollbooth.save(item)
})
@roberto-butti
roberto-butti / webpack.config.js
Created March 31, 2017 12:21
Minimal Webpack config file
const path = require('path');
const webpack = require('webpack');
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: {
app: './app.js',
},
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist/',
@roberto-butti
roberto-butti / create_usb_boot_install_ubuntu.sh
Created April 30, 2017 06:12
Create USB bootable installer for Ubuntu
#replace sdX with your device. THIS COMMAND WILL DESTROY THE CONTENT OF YOUR DEVICE (/dev/sdX)
sudo umount /dev/sdX1
sudo dd if=ubuntu-17.04-desktop-amd64.iso of=/dev/sdX bs=4M
sync