Skip to content

Instantly share code, notes, and snippets.

View rlogiacco's full-sized avatar
💭
I may be slow to respond, be patient...

Roberto Lo Giacco rlogiacco

💭
I may be slow to respond, be patient...
View GitHub Profile
@rlogiacco
rlogiacco / pwrbutton.sh
Created January 6, 2016 00:25
PlusberryPi Power
#!/bin/bash
# monitor GPIO pin 21 for shutdown signal
# export GPIO pin 21 and set to input with pull-up
echo "21" > /sys/class/gpio/export
echo "in" > /sys/class/gpio/gpio21/direction
# wait for pin to go low
while [ true ]; do
if [ "$(cat /sys/class/gpio/gpio21/value)" == '0' ]; then
@rlogiacco
rlogiacco / 0_reuse_code.js
Created April 14, 2016 23:38
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@rlogiacco
rlogiacco / rsync-completed.sh
Last active November 11, 2016 22:24
Keep movies folder synchronized
#!/bin/bash
exec 5>&1
SHARE="/mnt/TORRENT/completed"
LOCAL="/media/STORAGE/@temp"
FILES="/media/STORAGE/@new"
TIMESTAMP="$(date '+%d %h %y %H:%M:%S')"
LOCK="rsync-completed.lock"
# acquire lock
@rlogiacco
rlogiacco / start.sh
Last active January 10, 2017 12:15
Docker 1.12 for Windows start script
#!/bin/bash
trap '[ "$?" -eq 0 ] || read -p "Looks like something went wrong... Press any key to continue..."' EXIT
VM=default
DOCKER_MACHINE=./docker-machine.exe
export PATH="/c/Program Files/Docker Toolbox:$PATH"
export HTTP_PROXY=10.235.34.235:3129
export HTTPS_PROXY=10.235.34.235:3129
for n in $(docker-machine ls --format {{.Name}}); do
@rlogiacco
rlogiacco / final_3x3x3.ino
Created March 31, 2017 00:26
Innov@ction
#include <Elapsed.h>
#include <Effects.h>
#include <Qube.h>
#include <FormattingSerialDebug.h>
#define BUTTON_PIN 2
#define SIZE 3
const int pins[SIZE][SIZE] = { //
{ 3, 4, 5 }, // row 1
{ 6, 7, 8 }, // row 2
@rlogiacco
rlogiacco / CircularBuffer.h
Last active April 25, 2017 01:50
CircularBuffer
/*
CircularBuffer.h - Circular buffer library for Arduino.
Copyright (c) 2017 Roberto Lo Giacco. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
@rlogiacco
rlogiacco / Cubo3x3x3.ino
Created May 8, 2017 13:42
GeekL@b Cube
#include <Effects.h>
#include <Elapsed.h>
#include <Qube.h>
#define BUTTON_PIN 2
#define SIZE 3
const int pins[SIZE][SIZE] = { //
{ 3, 4, 5 }, // row 1
{ 6, 7, 8 }, // row 2
{ 9, 10, 11 } // row 3
@rlogiacco
rlogiacco / freeRam.h
Created September 5, 2017 21:02
Arduino free RAM
int freeRam() {
extern int __heap_start, *__brkval;
int v;
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}
@rlogiacco
rlogiacco / CapTouch Test
Created September 25, 2018 11:36
CapTouch
int ref0, ref1; //reference values to remove offset
int ADCTouch_read(byte ADCChannel, int samples) {
long _value = 0;
for(int _counter = 0; _counter < samples; _counter ++)
{
pinMode(ADCChannel, INPUT_PULLUP);
analogRead(ADCChannel);
@rlogiacco
rlogiacco / Plastico.ino
Last active November 17, 2018 02:03
Innov@ction
#include "Arduino.h"
#include <FastLED.h>
#include <elapsedMillis.h>
#include <FormattingSerialDebug.h>
#define PIN_LEGENDA 2
#define PIN_PLASTICO 3
#define NUM_STANZE 13
#define LED_COUNT_LEGENDA 13