Skip to content

Instantly share code, notes, and snippets.

View dlion's full-sized avatar
🦁
If you can dream it, you can do it ~

Domenico Luciani dlion

🦁
If you can dream it, you can do it ~
View GitHub Profile
@dlion
dlion / robot.js
Created December 7, 2012 00:45
Smagen
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.rotateCannon(360);
@dlion
dlion / .alert-script.sh
Created December 4, 2012 15:01
Script per il controllo della carica e della temperatura della mia slackware
#!/bin/bash
#Script per il controllo della batteria e della temperatura
while :
do
BATT=$(acpitool -b | grep -Po ", (.*)\." | sed -e s/,\ //g | sed -e s/\\.//g)
TEMP=$(cat /sys/class/hwmon/hwmon0/temp1_input)
if [ $BATT -lt 5 ]; then
xmessage "La batteria e' sotto il 5% il pc verra' spento in 8 secondi" -center -timeout 8
halt
@dlion
dlion / gist:3849963
Created October 7, 2012 23:31
bash function to upload on my filepicker.io space my file from CLI.
#!/bin/bash
# upfile
# Copyright (C) 2012 Domenico Luciani aka DLion
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
@dlion
dlion / jsPointer.c
Created October 1, 2012 23:38
Simple snippet to move the pointer on the screen using a joystick
/*###############################################################################
*# @Author : Domenico Luciani aka DLion
*# @Description: Simple snippet for move the pointer on the screen using a joystick
*# @How compile: g++ <source> -o <binary> -lplibjs -lplibsl -lplibsm -lplibul -lm -lX11
*# @Copyright : 2012
*# @Site : http://www.about.me/DLion
*# @License : GNU AGPL v3 http://www.gnu.org/licenses/agpl.html
*###############################################################################*/
#include <X11/Xlib.h>
@dlion
dlion / function.c
Created September 4, 2012 22:23
sizeFile function, return size of a file
long sizeFile(FILE *file)
{
long pos_now,size;
//Posizione attuale
pos_now = ftell(file);
//Mi posiziono alla fine del file
fseek(file,0,SEEK_END);
//Prendo la dimensione
size = ftell(file);
@dlion
dlion / BorderCanny.c
Created August 28, 2012 23:25
A simple snippet for retrieve frames from the webcam and make only the contourn of the image with Canny filter using OpenCV
/*
* Rilevatore di bordi con canny
* Snippet by Domenico Luciani aka DLion
*/
#include <highgui.h>
#include <cv.h>
int main()
{