Skip to content

Instantly share code, notes, and snippets.

@lucabelluccini
lucabelluccini / firmware.c
Last active December 17, 2015 11:48
DesktopDefender Sketch for Arduino v1 + Schematics
/*
+-------+-------+------+--------+------+-------+--------+ K BLACK
| BLACK | WHITE | GREY | PURPLE | BLUE | GREEN | YELLOW |
+---+---+--+----+--+---+-+------+--+---+---+---+----+---+ R RED
+ + + + + + +
| | | | | | | G GREEN
+------|-----+-|-----|-+ | | |
+-|-----|-|-----|-|-----+-|-----+-+ |
| | | | | | | | | |
@lucabelluccini
lucabelluccini / BatchPostToBlogger.js
Created March 8, 2014 20:39
A node.js script to perform bulk posting to Blogger. See comments to get your Auth key :D
// var gapi = require('googleapis'); // Cannot use it
var https = require('https');
// Template for Post content
swig = require('swig'),
extras = require('swig-extras');
extras.useFilter(swig, 'truncate');
var template = swig.compileFile('ABSOLUTE-PATH-TO-TEMPLATE/template.html');
// Read file containing information
@lucabelluccini
lucabelluccini / test_webcam.py
Created May 8, 2014 15:59
Testing 2 webcams for stereo vision
import cv2, numpy
webcamL_index = 1
webcamR_index = 0
webcam_h = 640
webcam_v = 480
viewport_size = (1920, 1080)
webcamL = cv2.VideoCapture(webcamL_index)
webcamL.set(3, webcam_h)
@lucabelluccini
lucabelluccini / Shader4S.cg
Last active August 29, 2015 14:01
Self Lit, Alpha channel (global), Texture mapped to UV, Mask mapped to UV2
Shader "Custom/Shader4S" {
Properties {
_MainTex ("Texture", 2D) = "white" { }
_Mask ("Mask", 2D) = "white" {}
_Alpha ("Alpha", Range(0.0,1.0)) = 1.0
}
SubShader {
Tags { Queue = Transparent }
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
@lucabelluccini
lucabelluccini / Shader4SNoMask.shader
Last active August 29, 2015 14:01
Self Lit, Alpha channel (global), Texture mapped to UV
Shader "Custom/Shader4SNoMask" {
Properties {
_MainTex ("Texture", 2D) = "white" { }
_Alpha ("Alpha", Range(0.0,1.0)) = 1.0
}
SubShader {
Tags { Queue = Transparent }
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Pass {
@lucabelluccini
lucabelluccini / elasticsearch.log
Last active August 29, 2015 14:02
Exception when reaching maximum number of memory mapped files.
To see more:
- http://jprante.github.io/applications/2012/07/26/Mmap-with-Lucene.html
- http://blog.thetaphi.de/2012/07/use-lucenes-mmapdirectory-on-64bit.html
The store type in ES changed from 0.90.9 to 1.2 to match the Lucene defaults, which means that now its mmapfs by default.
You are probably running into the OS limits of mmap counts.
You might need to run something like this:
sysctl -q -w vm.max_map_count=262144
129450 [2014-06-12 09:32:14,061][DEBUG][action.admin.cluster.stats] [XXXXXXXX] failed to execute on node [ABl2CA6_SuGDxdmXnqMgFA]
@lucabelluccini
lucabelluccini / Shader4SHUD.shader
Last active August 29, 2015 14:02
Self Lit, Alpha channel (global), Texture mapped to UV, Overlay
Shader "Custom/Shader4SHUD" {
Properties {
_MainTex ("Texture", 2D) = "white" { }
_Alpha ("Alpha", Range(0.0,1.0)) = 1.0
}
SubShader {
Tags { Queue = Overlay }
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
Pass {
@lucabelluccini
lucabelluccini / Shader4SWithNormal.shader
Created June 12, 2014 23:10
Self Lit, Alpha channel (global), Texture & Bump mapping mapped to UV, Mask mapped to UV2
Shader "Custom/Shader4SWithNormal" {
Properties {
_MainTex ("Texture", 2D) = "white" { }
_Mask ("Mask", 2D) = "white" {}
_Alpha ("Alpha", Range(0.0,1.0)) = 1.0
_BumpMap ("Normal Map", 2D) = "bump" {}
_Illum ("Illumin (A)", 2D) = "white" {}
}
SubShader {
@lucabelluccini
lucabelluccini / clean-ubuntu
Created July 8, 2014 23:18
Ubuntu 14.04 (maybe also 12.04) cleanup and update
sudo apt-get update && sudo apt-get dist-upgrade && sudo reboot
sudo apt-get install linux-headers-$(uname -r) build-essential dkms
sudo apt-get install gnome-session-fallback && sudo apt-get remove --purge unity
sudo apt-get remove libreoffice-core && sudo apt-get remove --purge libreoffice core && sudo apt-get remove --purge libreoffice 4.2*
sudo apt-get autoremove
sudo apt-get purge openjdk* && sudo apt-get install software-properties-common
wget -q -O - https://fixubuntu.com/fixubuntu.sh | bash
#include <Servo.h>
// Parallax Continuous Servo example (http://www.parallax.com/product/900-00025)
// Read values from serial and set the speed of the servo
// Range 0 to 180; 90 is no movement
// Remember to set the proper baud rate and carriage return settings
Servo theServo;
int gSpeed = 90;
void setup()