Skip to content

Instantly share code, notes, and snippets.

@fcalderan
fcalderan / meteotweet.php
Last active December 5, 2017 23:38
Arduino sketch code and PHP code for H-art tweeting weather station. This projects was tested with an Arduino UNO + ethernet shield + DHT22 sensor.
<?php
function roundNum($n) { return round(10 * $n)/10; }
// Insert your keys/tokens
$consumerKey = '<your-key>';
$consumerSecret = '<your-key>';
$oAuthToken = '<your-key>';
$oAuthSecret = '<your-key>';
# A Liquid tag for random number generation
# Usage: {% random min:max %} where min and max are integers and min < max
module Jekyll
class Random < Liquid::Tag
def initialize(tag_name, range, tokens)
super
limits = range.split(":")
@min = limits[0].to_i
@fcalderan
fcalderan / pulcino.pio.js
Last active August 29, 2015 14:07 — forked from anonymous/pulcino.pio.js
Javascript generator of “Il pulcino pio” song lyric: http://www.youtube.com/watch?v=juqyzgnbspY
/* JSHint validated - copy into a javascript console and look at the output */
(function(title) {
"use strict";
var lyrics = title.toUpperCase() + "\n---\n";
var even, verse;
var sayAnimal = function(i) {
even = !even
@fcalderan
fcalderan / ffmpeg.txt
Created June 16, 2015 13:55
Handy FFmpeg commands
# Build ffmpeg on MacOs
# https://trac.ffmpeg.org/wiki/CompilationGuide/MacOSX
> brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-libass --with-libquvi --with-libvorbis --with-libvpx --with-opus --with-x265
# Conversion to WEBM format:
# http://trac.ffmpeg.org/wiki/Encode/VP8
> ffmpeg -i input-file.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output-file.webm
@fcalderan
fcalderan / SASS aspect ratio.css
Last active August 29, 2015 14:23
Generated by SassMeister.com.
section {
width: 35%;
}
section div {
/* Aspect ratio: 16:9 */
height: 0;
width: 100%;
position: relative;
padding-bottom: 56.25%;
}
@fcalderan
fcalderan / SassMeister-input-HTML.html
Last active August 29, 2015 14:24
Generated by SassMeister.com.
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
@fcalderan
fcalderan / Jekyll-base64.md
Last active June 24, 2023 19:39
A Base64 image encoder plugin for JekyllRB

#Jekyll Base64 Encoder A Liquid tag for base64 encoding

Note: this plugin requires Colorize:

gem install colorize
@fcalderan
fcalderan / ftf.sh
Last active February 25, 2016 10:32
From the Front Early Bird Detector
#!/bin/sh
# set last 2 digits of the current year
year=16
# set terminal title
echo "\033]0;FTF Early Bird Checker\007";
@fcalderan
fcalderan / 1) tidy-numbers-stmt.txt
Last active March 9, 2018 12:53
An implementation of the problem B - Tidy numbers: Google Code Jam 2017
# Complete statement of the problem
# https://code.google.com/codejam/contest/3264486/dashboard#s=p1
# Tatiana likes to keep things tidy. Her toys are sorted from smallest
# to largest, her pencils are sorted from shortest to longest and her computers
# from oldest to newest. One day, when practicing her counting skills, she
# noticed that some integers, when written in base 10 with no leading zeroes,
# have their digits sorted in non-decreasing order. Some examples of this are 8,
# 123, 555, and 224488. She decided to call these numbers tidy. Numbers that do
# not have this property, like 20, 321, 495 and 999990, are not tidy.
@fcalderan
fcalderan / google-showimage.js
Last active June 4, 2018 07:58
Restore "Show image" in google image results
/* Usage:
* when Google image returns some results, before choosing an image just inject
* this code into the JS console and a new button with a direct link to the image
* will appear inside the overlay.
*/
var config = {
attributes: true,
childList: false,
characterData: false,