Skip to content

Instantly share code, notes, and snippets.

Luca Faggianelli lucafaggianelli

View GitHub Profile
View Calendar.vue
<template>
<v-layout>
<v-flex xs12>
<v-card>
<v-toolbar flat>
<!-- Today Button -->
<v-tooltip bottom>
<v-btn slot="activator"
flat
color="primary"
@lucafaggianelli
lucafaggianelli / rgb-led-fw.c
Last active Apr 10, 2016
PIC18 firmware for RGB LED driver
View rgb-led-fw.c
#define ST_CHAR 0xFE
#define ESC_CHAR 0xFD
#define MSG_LEN 6
unsigned char rxCounter = 0, escaped = 0, in_msg = 0, rxBuffer[MSG_LEN];
void parseSerialMsg(void) {
static unsigned char byte, status;
if (DataRdyUSART()) {
View freebase.rb
module Freebase
require 'rest-client'
NS = 'http://rdf.freebase.com/ns'
API_URL = 'https://www.googleapis.com/freebase/v1'
API_KEY = 'your_key_here'
RestClient.proxy = ENV['http_proxy']
MQLClient = RestClient::Resource.new(API_URL)
View freebase.js
var Freebase = {
api: 'https://www.googleapis.com/freebase/v1',
key: '?key=' + 'your_key_here',
// Main image (icon) of a topic
img: function(mid) {
return this.api + '/image' + mid + this.key;
},
// MQL query with callback on success
View build_done_template.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; box-sizing: border-box; font-size: 14px; margin: 0;">
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Actionable emails e.g. reset password</title>
<style type="text/css">
img {
View mailgun.py
#!/usr/bin/env python
import sys
import requests
import logging
from jinja2 import Template
template = None
html = None
URL = "https://api.mailgun.net/v3/sandbox4a7ba08a09ec40b4a668b550607547a8.mailgun.org/messages"
KEY = "key-ed60f4288cb8b9c15d876ad2ae06c545"
@lucafaggianelli
lucafaggianelli / font_awesome_android.py
Created Jan 7, 2015
Font Awesome LESS to Android XML
View font_awesome_android.py
import sys
import urllib2
import re
# LESS source file
FA_LESS_URL = 'https://raw.githubusercontent.com/FortAwesome/Font-Awesome/master/less/variables.less'
# REGEX
re_less_var = re.compile('.*:\s*"(.*)";')
re_fa_var = re.compile('^@fa-var-(.*):\s*"\\\\(.*)";')
View server.py
#!/usr/bin/python
import SimpleHTTPServer
import SocketServer
from urlparse import urlparse, parse_qs
import cgi
import logging
from datetime import datetime
PORT = 8000
@lucafaggianelli
lucafaggianelli / pool-downloader.py
Created Aug 27, 2014
Download many files in parallel
View pool-downloader.py
import os
import time
import urllib2
from multiprocessing import Pool
BASE = 'http://images.philips.com/is/image/PhilipsConsumer/HD8761_01-P3D-global-{0:0>3}?$pngsmall$'
def millis():
return int(round(time.time() * 1000))
You can’t perform that action at this time.