Skip to content

Instantly share code, notes, and snippets.

View maticrivo's full-sized avatar

Matias Crivolotti maticrivo

View GitHub Profile
@maticrivo
maticrivo / epub.css
Created January 10, 2018 08:30 — forked from bmaupin/epub.css
You Don't Know JS Ebooks
body {
text-align: justify;
}
code, pre {
font-family: "Hack", monospace;
}
h1, h2, h3, h4, h5, h6 {
text-align: left;
@maticrivo
maticrivo / trace.log
Created February 20, 2017 11:34
dokku trace on
$ git push dokku master -f
+ export DOKKU_DISTRO
++ . /etc/os-release
++ echo ubuntu
+ DOKKU_DISTRO=ubuntu
+ export DOKKU_IMAGE=gliderlabs/herokuish
+ DOKKU_IMAGE=gliderlabs/herokuish
+ export DOKKU_LIB_ROOT=/var/lib/dokku
+ DOKKU_LIB_ROOT=/var/lib/dokku
+ export PLUGIN_PATH=/var/lib/dokku/plugins
@maticrivo
maticrivo / gist:4624e907e8405f371f89
Created September 16, 2015 10:24
Sickrage auto-start on osmc
git clone https://github.com/echel0n/SickRage.git sickrage
cd sickrage/
sudo cp runscripts/init.systemd /etc/systemd/system/sickrage.service
sudo chmod -x /etc/systemd/system/sickrage.service
sudo vim /etc/systemd/system/sickrage.service
sudo systemctl enable sickrage.service
sudo systemctl start sickrage.service
@maticrivo
maticrivo / EXAMPLE.conf
Created August 20, 2015 11:35
example for simple /etc/init/ service in ubuntu
description "EXAMPLE"
author "Matias Crivlotti <matioav@gmail.com>"
start on runlevel [2345]
stop on runlevel [!2345]
script
exec <command to execute>
end script
import os
import time
import sys
import unittest
from appium import webdriver
class TestCase(unittest.TestCase):
@maticrivo
maticrivo / qpdf.sh
Last active August 29, 2015 14:10 — forked from amirnissim/qpdf.sh
brew install qpdf
# first decrypt
qpdf --decrypt --password=mypass <FILE_NAME> dec-<FILE_NAME>.pdf
# merge
qpdf --empty --pages dec*.pdf -- all.pdf
{
"alt-speed-down": 999999999,
"alt-speed-enabled": false,
"alt-speed-time-begin": 540,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": false,
"alt-speed-time-end": 1020,
"alt-speed-up": 2,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
@maticrivo
maticrivo / readingIndicator.js
Last active September 12, 2017 12:51
Creates a reading indicator
(function(){
var Indicator = function(){
var self = this, bar, latestKnownScrollY, ticking;
this.init = function init() {
latestKnownScrollY = window.scrollY;
ticking = false;
self.createIndicator();
//Open the file directly in the browser and run this script from the console
//Assumptions: The browser uses a <pre/> tag for showing the CSS code
var file = document.querySelector("pre");
var fileContent = file.innerHTML;
var newContent = fileContent.replace(/([\d.]+)(px)/g, function(m){
var measure = parseFloat(m.split("px")[0]);
var newMeasure = measure / 10;
newMeasure = newMeasure.toFixed(2);
newMeasure = newMeasure.replace(/(\.[0-9]*?)0+$/, "$1"); // remove trailing zeros