Skip to content

Instantly share code, notes, and snippets.

View maurocolella's full-sized avatar
:octocat:
Focused

Mauro Colella maurocolella

:octocat:
Focused
View GitHub Profile
@maurocolella
maurocolella / getsubtitles.desktop
Last active November 1, 2020 03:12
KDE5 Dolphin Subliminal Integration
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=video/*;
Actions=getSubtitles
[Desktop Action getSubtitles]
Name=Get Subtitles
Icon=plasma
Exec=konsole -e subliminal download -l en -s %U
@maurocolella
maurocolella / gist:f2d2255096902f437e9bfbd1e8558022
Created August 25, 2019 07:37
electron-react-boilerplate-issue-stacktrace
internals\scripts\CheckPortInUse.js:13
throw new Error(_chalk.default.whiteBright.bgRed.bold(`Port "${port}" on "localhost" is already in use. Please use another port. ex: PORT=4343 yarn dev`));
^
Error: Port "1212" on "localhost" is already in use. Please use another port. ex: PORT=4343 yarn dev
at C:\Users\Argo\Documents\_dev\automation\chocolatey-sync\internals\scripts/CheckPortInUse.js:10:13
at listen (C:\Users\Argo\Documents\_dev\automation\chocolatey-sync\node_modules\detect-port\lib\detect-port.js:93:13)
at Server.server.listen (C:\Users\Argo\Documents\_dev\automation\chocolatey-sync\node_modules\detect-port\lib\detect-port.js:118:12)
at Object.onceWrapper (events.js:273:13)
at Server.emit (events.js:182:13)
@maurocolella
maurocolella / webpack.config.js
Last active August 26, 2019 09:04
Test case for webpack 4 error with postcss-loader.
var path = require('path');
var webpack = require('webpack');
var UglifyJSPlugin = require('uglifyjs-webpack-plugin');
var autoprefixer = require('autoprefixer');
module.exports = {
mode: 'development',
devtool: 'cheap-module-source-map',
entry: {
client : [
@maurocolella
maurocolella / inline-styles.js
Last active August 26, 2019 09:02
Automatically inline all styles in a web page.
function renderStyles(){
var rules = document.getElementById('stylesheetLinkName').sheet.cssRules;
//console.log(document.styleSheets);
for (var idx = 0, len = rules.length; idx < len; idx++) {
var collection = document.querySelectorAll(rules[idx].selectorText);
var pointer = 0;
for(pointer = 0; pointer < collection.length; pointer++){
collection[pointer].style.cssText += rules[idx].style.cssText;
@maurocolella
maurocolella / hhvm-to-php7.txt
Last active August 26, 2019 09:03
Notes for PHP7(.0) compilation to a feature set similar to HHVM's defaults.
/**
* Instructions to compile PHP7 with a feature set
* as close as possible to HHVM core and extensions.
*
* Target: Debian 7.x and derivatives.
*
* Latest update:
* August 5, 2015
*
*
@maurocolella
maurocolella / subliminal.nemo_action
Created January 31, 2015 07:52
Desktop action for the Nemo File Manager, to download subtitles.
[Nemo Action]
Active=true
Name=Download subtitles...
Comment=Download subtitles for a movie
Exec=gnome-terminal -x sh -c "cd '%P' && subliminal -l en -s '%U'"
@maurocolella
maurocolella / gd.upload.php
Last active September 16, 2020 00:47
PHP: Upload images while converting them to jpeg * with white background, if applicable.
<?php
/* gd.upload.php
* Upload images while converting them to jpeg
* with white background, if applicable.
*
* (c) 2014 Mauro Colella
* This code is licensed under MIT license (see http://opensource.org/licenses/MIT for details)
*/
@maurocolella
maurocolella / compiz_openbox.sh
Last active August 29, 2015 14:07
Toggle between Compiz and Openbox on Ubuntu
#!/usr/bin/env bash
# Toggle between Compiz and Openbox on Ubuntu.
#
# (c) 2014 Mauro Colella
# This code is licensed under MIT license (see http://opensource.org/licenses/MIT for details)
#
if ps -C openbox | grep openbox;
then
echo "Switching to Compiz"
@maurocolella
maurocolella / barebones.sh
Last active August 26, 2019 09:05
Bash script to compress assets of a website for production.
#!/usr/bin/env bash
# Compress/minify all assets of a website in place.
#
# (c) 2014 Mauro Colella
# This code is licensed under MIT license (see http://opensource.org/licenses/MIT for details)
#
find . -name "*.jpg" -print0 | xargs -0 -I filename jpegtran -copy none -progressive -optimise -outfile filename filename
find . -name "*.png" -print0 | xargs -0 -I filename optipng filename
find . -name "*.css" -print0 | xargs -0 -I filename csso -i filename -o filename filename
@maurocolella
maurocolella / lemp.sh
Last active June 9, 2016 18:00
Start / stop LEMP stack (nginx) on Linux
#!/usr/bin/env bash
# Start/stop the LEMP stack on Ubuntu Linux.
#
# (c) 2014 Mauro Colella
# This code is licensed under MIT license (see http://opensource.org/licenses/MIT for details)
#
echo "Start/stop the extended LEMP stack"
sudo -s
if service nginx status | grep not;