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_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 / .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
@roberto-butti
roberto-butti / example_com.conf
Created May 4, 2017 17:26
Nginx virtual host configuration with PHP (Ubuntu server)
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/example.com/htdocs/public;
index index.php index.html index.htm index.nginx-debian.html;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
@roberto-butti
roberto-butti / users.php
Created May 24, 2017 12:31
Users.php is the representation of a model (User) in the admin interface.
<?php
return array(
'title' => 'Users',
'single' => 'user',
'model' => 'App\User',
/**
* The display columns
*/
'columns' => array(
@roberto-butti
roberto-butti / webpack.config.js
Created May 29, 2017 19:57
webpack configuration file for Vue Loader
// VUE-LOADER: loading module Vue
const vue = require('vue-loader');
const path = require('path');
const webpack = require('webpack');
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: {
app: './app.js',
},
output: {