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 / insert.go
Created September 15, 2014 09:30
InsertionSort
package main
import "fmt"
func main() {
array := [6]int{5, 3, 1, 7, 2}
for k := 0; k <= 5; k++ {
m := k
for j := k + 1; j <= 5; j++ {
if array[j] < array[m] {
#include <stdio.h>
#include <stdlib.h>
typedef struct albero {
int valore;
struct albero *dx;
struct albero *sx;
} ABR;
ABR* insert(ABR* A, int value)

Keybase proof

I hereby claim:

  • I am dlion on github.
  • I am dlion (https://keybase.io/dlion) on keybase.
  • I have a public key whose fingerprint is 7214 7EBB B299 706D 8621 43E1 A3D8 68BE 560A CEB0

To claim this, I am signing this object:

@dlion
dlion / smagenBot.Dockerfile
Created June 25, 2015 16:55
Simple Dockerfile to build an image of ubuntu to run my smagenBot
FROM ubuntu:latest
MAINTAINER Domenico Luciani "domenicoleoneluciani@gmail.com"
RUN apt-get update
RUN apt-get install -y git nodejs npm
RUN git clone https://github.com/dlion/smagenBot /home/root/smagenBot
ADD config.json /home/root/smagenBot/
WORKDIR /home/root/smagenBot
RUN npm install
@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()
{
@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 / 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 / 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 / .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 / 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);