Skip to content

Instantly share code, notes, and snippets.

View azihassan's full-sized avatar
🦆

Azi Hassan azihassan

🦆
View GitHub Profile
@azihassan
azihassan / zhangsuen.cpp
Created March 7, 2018 00:22
Zhang-Suen thinning algorithm
#include <iostream>
#include <vector>
using namespace std;
struct Point
{
size_t x;
size_t y;
Point() : x(0), y(0) {}
#include <SoftwareSerial.h>
#include "SIM900.h"
bool gprs_active;
char incoming[255] = "";
bool handling_call;
void setup()
{
handling_call = false;
#include <iostream>
#include <vector>
#include <SFML/Graphics.hpp>
class Scroller
{
sf::Texture texture;
sf::IntRect rect;
public:
Scroller(sf::Texture& texture)
#include <iostream>
#include <algorithm>
#include <array>
#include <utility>
#include <map>
#include <vector>
#include <queue>
struct Point
{
@azihassan
azihassan / xml.php
Created December 16, 2015 15:59
SimpleXML usage example
<form method = "post">
<p><label>Nom : <input type = "text" name = "nom" /></label></p>
<p><label>Prenom : <input type = "text" name = "prenom" /></label></p>
<p><label>CIN : <input type = "text" name = "cin" /></label></p>
<p><label>Adresse : <input type = "text" name = "adresse" /></label></p>
<p><label>Email : <input type = "text" name = "email" /></label></p>
<p><input type = "submit" value = "Convertir" /></p>
</form>
<?php
@azihassan
azihassan / filecomp.php
Last active December 14, 2015 19:33
Memory-friendly function that compares two files and returns a boolean
<?php
if(compare_files('file1', 'file2'))
echo 'Files are similar', PHP_EOL;
else
echo 'Files are different', PHP_EOL;
function compare_files($a, $b, $buf_size = 1048576)
{
if($a === $b)
return true;
loadDetailsButton.click ~= &loadDetailsButton;
//...
void loadDetailsCallback(Control sender, EventArgs ea)
{
if(!urlBox.text)
{
msgBox("No URL was provided.", "Error", MsgBoxButtons.OK, MsgBoxIcon.INFORMATION);
urlBox.focus();
@azihassan
azihassan / sqli.php
Created May 4, 2015 10:14
SQLi demonstration.
<?php
session_start();
$conn = mysqli_connect('localhost', 'root', '', 'test');
if(mysqli_connect_error())
{
echo '<p>Connexion à la base de données échouée : ' . mysqli_connect_error() . '</p>';
exit;
}
?>
@azihassan
azihassan / NeymarS.d
Created September 26, 2014 15:53
Recursively copies the given "file" to all the directories inside the "root" folder. http://www.hackforums.net/showthread.php?tid=4462689&pid=42561339
import std.stdio;
import std.file;
import std.path : buildPath;
import std.exception : enforce;
int main(string[] args)
{
string root;
string file;
@azihassan
azihassan / imgur_album.php
Created July 15, 2012 12:04
Imgur album scraper
<?php
try
{
list($id, $path) = parse_argv($argv);
$links = get_links($id);
if(($link_count = sizeof($links)) === 0)
{
echo 'No links were found.'.PHP_EOL;