Skip to content

Instantly share code, notes, and snippets.

View ikarius6's full-sized avatar

Mr.Jack ikarius6

  • México
View GitHub Profile
<?php
/*
AES256 v1.0 MrJack
https://gist.github.com/1077723/0a9a7c5299a7fb4340e4b2064fd383ef236a5aa5
https://gist.github.com/RiANOl/1077723
*/
function aes256Encrypt($key, $data, $mode = MCRYPT_MODE_CBC) {
if(32 !== strlen($key)) $key = hash('SHA256', $key, true);
$padding = 16 - (strlen($data) % 16);
<?php
/* Regex generator for valid TLDs - By MrJack*/
$txt = file_get_contents('http://data.iana.org/TLD/tlds-alpha-by-domain.txt');
$tlds = preg_split('/\s+/', $txt);
$valid_tld = array();
foreach($tlds as $tld){
if (! preg_match('/[^a-z]+/i', $tld, $matches)){
if(strlen($tld) > 3){
array_push($valid_tld, strtolower($tld));
}
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
<?php
/* PHP Headers for CSV File with UTF-8 - By MrJack*/
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=reporte_ganadores_".date("d-m-Y").".csv");
header("Pragma: no-cache");
header("Expires: 0");
echo "\xEF\xBB\xBF"; //<--- here is the magic
echo "WHATÉVER";
@ikarius6
ikarius6 / Test.php
Created February 2, 2016 23:46
CI Auth Basic
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
//application/controllers/Test.php
class Test extends MY_Controller {
private $username = 'admin';
private $salt = 'immaveryveryveryverylongsalt';
private $password = 'c25c068f620bae40f6de49aa32bc7a036989baae382f64d7cc41f89a741ff6ae'; //supersecret
function __construct(){
parent::__construct();
@ikarius6
ikarius6 / rfc.php
Last active February 5, 2016 20:27
Registro Federal de Contribuyentes (RFC) regex PHP
<?php
/*
RFC Regex by Jack
Valid:
JACK880229AA1
JACK880229
Invalid:
JACK880230AA1
JACK890229AA1
@ikarius6
ikarius6 / colors.html
Last active February 11, 2016 17:57
Color percentage-based generator
<script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>
<script>
/*
Color percentage-based generator - by Jack
https://jsfiddle.net/xjmjjvdf/1/
*/
function percentage_to_color( perc ){ //0 = red, 100 = green
var mod = perc%101; // 0 > perc <= 100
var v = Math.floor( mod * 5.1 );
var r = ("00"+(v>255? 255-(v%256): 255).toString(16)).slice(-2);
<?php
/*
OAuthSimple by jr conlin
http://unitedHeroes.net/OAuthSimple
Refactor to PHP by MrJack.org
*/
class OAuthSimple
{
private $_secrets=[];
private $_default_signature_method= "HMAC-SHA1";
@ikarius6
ikarius6 / clue_test.html
Created April 6, 2016 22:35
Where can I walk step by step? - on JS - by Jack
<script>
/*
Where can I walk step by step? - by Jack
0 = can walk
1 = a wall
Other numbers > padding = steps
*/
var map = [
@ikarius6
ikarius6 / pokemon.php
Last active April 13, 2016 23:25
Getting GIFs of pokemons (1 hour lazy script), separed by national (n_*) and johto (j_*) numbers
<?php
/*
Getting GIFs of pokemons by Jack
*/
set_time_limit( 0 );
$dwl_folder = "./img"; //edit this
$p1 = get("http://es.pokemon.wikia.com/wiki/Lista_de_Pok%C3%A9mon_de_la_primera_generaci%C3%B3n");
preg_match_all('/<table class="tabpokemon sortable mergetable" style="text-align:center; width:100%;">(?<trs>.*?)<\/table>/si', $p1['response'], $matches);