Skip to content

Instantly share code, notes, and snippets.

View HorlogeSkynet's full-sized avatar

Samuel FORESTIER HorlogeSkynet

View GitHub Profile
@HorlogeSkynet
HorlogeSkynet / puzzledNumber.c
Last active September 24, 2017 02:38
A simple C program to decompose a number in powers of 10
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <inttypes.h>
#define POWER(x, y) (long int)pow(x, (float)y)
uint8_t* puzzledNumber(int32_t number, uint16_t *size)
@HorlogeSkynet
HorlogeSkynet / primeNumbersInterval.py
Last active September 24, 2017 02:26
A simple Python script to display prime numbers present within a given interval
#!/usr/bin/env python3
# -*-coding:utf-8 -*
from math import sqrt
def premier(borne1, borne2):
nombresPremiers = 0
@HorlogeSkynet
HorlogeSkynet / buyMenu.lua
Created September 11, 2016 00:19
buyMenu.lua file modified (Just Cause 2 Multiplayer)
class 'BuyMenu'
class 'BuyMenuEntry'
function BuyMenuEntry:__init( model_id, price, entry_type )
self.model_id = model_id
self.price = price
self.entry_type = entry_type
end
function BuyMenuEntry:GetPrice()
@HorlogeSkynet
HorlogeSkynet / Duemilanove.ino
Last active November 21, 2016 19:57
Two Arduino programs for GreenHouse system
#include "LCD4884.h"
//#include "Wire.h"
#include "Servo.h"
Servo servo;
//#include "Adafruit_BMP085.h"
//Adafruit_BMP085 bmp;
#define DEBOUNCE_MAX 15
#define DEBOUNCE_ON 10
#define DEBOUNCE_OFF 3
@HorlogeSkynet
HorlogeSkynet / selfReliantParasol.ino
Last active August 21, 2017 07:50
Simple code which modelises a self reliant parasol on Arduino
const int relais = 4;
const int switch_haut = 3;
const int switch_bas = 2;
const int photoresistance = A0;
const int anemometre = A1;
void setup()
{
@HorlogeSkynet
HorlogeSkynet / waterFountain.ino
Last active August 21, 2017 07:50
Simple code which modelises a water fountain on Arduino
const int switchG = 2;
const int switchA = 3;
const int switchB = 4;
const int switchC = 5;
const int vanne = 6;
int switchGstate = 0;
int switchAstate = 0;
int switchBstate = 0;
int switchCstate = 0;
@HorlogeSkynet
HorlogeSkynet / ITERRobot2014.c
Last active May 25, 2019 13:44
Our code for the ITER Robot 2014 edition
#include "LSA-lib.nxc" //http://www.mindsensors.com/index.php?module=documents&JAS_DocumentManager_op=viewDocument&JAS_Document_id=219
#define LeftMotor OUT_A
#define RightMotor OUT_C
#define BothMotors OUT_AC
#define Plateforme OUT_B
#define Capteur_Couleur IN_1
#define Capteur_Ligne IN_2
#define ADDR 0x14
@HorlogeSkynet
HorlogeSkynet / BluetoothCLI.sh
Last active November 21, 2016 19:36
BASH script allows user to work with Bluetooth in CLI
#!/bin/bash
clear
echo -e "\n\t\t#Bluetooth script by Horloge-Skynet.\n"
echo -e "\t\033[1;31m/!\ Be sure that your Hardware Bluetooth is running... /!\ \033[0m \n\n"
if [ -d /usr/share/doc/bluez/ ] || [ -d /usr/share/doc/bluez-utils/ ]; then
echo -e "Bluetooth of \033[1m$USER\033[0m on \033[1m$HOSTNAME\033[0m with \033[1m$SHELL\033[0m:"
@HorlogeSkynet
HorlogeSkynet / ShellSort.c
Last active August 21, 2017 07:44
A simple program which sorts a text file alphabetically (one string per line), with the Shell sort algorithm
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <errno.h>
#define BUFFERSIZE 64
void shellSort(const char *const);
@HorlogeSkynet
HorlogeSkynet / skyClear.c
Last active August 21, 2017 07:49
A simple C function to clear the terminal without using the bad `system("clear")`
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/wait.h>
void sky_clear(void)
{