This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
short split(char string[], char * words[]) | |
{ | |
const char separators[] = ",; :"; | |
char * token; | |
short i = 0; | |
token = strtok(string, separators); | |
while (token != NULL) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function integerDivision(dividend, divider) | |
if divider == 0 then error("Stupid! You can't divide by 0!") end | |
local rest = dividend | |
local quotient = 0 | |
while rest >= divider do | |
dividend = dividend - divider | |
rest = dividend |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gets steam stats from Steam's API | |
* @author Gabriel Santamaria <gaby.santamaria@outlook.fr> | |
*/ | |
$steam_api = "APIKEYLOL"; | |
$steam_id = "76561198127516196"; | |
$jsonurl = "http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?key=" . $steam_api . "&steamid=" . $steam_id . "&format=json"; | |
$json = file_get_contents($jsonurl); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Gets github stats from Github's API | |
* @author Gabriel Santamaria <gaby.santamaria@outlook.fr> | |
*/ | |
$github_user = "Gabyfle"; | |
$github_token = "YOURGITHUBTOKEN"; | |
$get_options = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Write a new $value in a $param for an .ini file | |
* | |
* @param string $path path of the .ini file | |
* @param string $param parameter to change | |
* @param string $value value to put in $param | |
* @return string | |
*/ | |
function write_ini_file(string $path, string $param, string $value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Parse the owner's name and the name of the repository (works only with github) | |
* | |
* @param string $repo_url the repositery url | |
* @return array [1] : the owner's name [2] : the repo name | |
*/ | |
function parse_repo_name(string $repo_url) | |
{ | |
$pattern = '/^https?:\/\/(?:www.)?github\.com\/(.*)\/(.*)/'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local config = { | |
['commandName'] = 'reboot_prevent', | |
['timer'] = 10, | |
['iterations'] = 5 | |
} | |
if SERVER then | |
local timerIteration = 1 | |
function launchReboot(time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function isZip(string $tmp, string $name) | |
{ | |
$extension = pathinfo($name, PATHINFO_EXTENSION); | |
$finfo = finfo_open(FILEINFO_MIME_TYPE); | |
$type = finfo_file($finfo, $tmp); | |
return $type === 'application/zip' && $extension === 'zip'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Delete recursively a directory | |
* Gist : https://gist.github.com/Gabyfle/d7e74e70da6efbeab1c3b2f9636dc178 | |
* | |
* @param string $path | |
*/ | |
function delete_directory(string $path): void | |
{ | |
$files = new \DirectoryIterator($path); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Number of seconds to convert | |
local seconds = 1850 | |
-- 1 day = 86400 s | |
-- 1 hour = 3600 s | |
-- 1 minute = 60 s | |
local days = math.floor(seconds / 86400) | |
local hours = math.floor((seconds - days * 86400) / 3600) | |
local minutes = math.floor((seconds - days * 86400 - hours * 3600) / 60) |
OlderNewer