Skip to content

Instantly share code, notes, and snippets.

View aa21's full-sized avatar

Alex Arul aa21

  • Hatcher, Blk 71
  • singapore
View GitHub Profile
@aa21
aa21 / SEC - common passwords
Last active March 27, 2019 16:04
Common Passwords & Usernames
password
123456
12345678
1234
qwerty
12345
dragon
pussy
baseball
football
<?php
error_reporting(-1); // reports all errors
ini_set("display_errors", "1"); // shows all errors
ini_set("log_errors", 1);
ini_set("error_log", "/tmp/php-error.log");
?>
@aa21
aa21 / PHP - MySql - Dynamic Table Columns
Last active January 23, 2018 03:38
Create table columns on the fly on a mysql db
<?php
$conn = mysqli_connect($ht, $ur, $pd);
mysqli_select_db($conn, $db);
//foreach req, check if the column exists, otherwise create it
foreach($_POST as $k => $v){
$key = trim(mysqli_real_escape_string($conn, $k));
<?php
class MM_Notifications {
private $usr_mentor;
private $usr_mentee;
private $mentor_action;
private $email_codes;
private $notice_type;
private $debug_email;
@aa21
aa21 / .php
Last active October 18, 2016 14:26
PHP - Aligning tabs, finding emails in string, remove empty columns from csv/data-grid array ..
<?php
// PRINT TAB ALIGNED COLUMNS
// %- and % are left and right aligns
$mask = "| %-30.30s | %10.10s | %10.10s |\n";
printf($mask, 'Host' , 'Results', 'Share');
printf($mask, $test_host, $total_results, $share_round);
@aa21
aa21 / Project Ideas.md
Last active August 24, 2016 01:15
Learning / Mastering a language
<?php
// if it's not a ISO8601 date string, skip it
if(stripos($v , "T") === false) continue;
$dateval = $v;
// create ISO8601 dateTime
$date = DateTime::createFromFormat(DateTime::ISO8601, $dateval);
// set to user's timezone
$date -> setTimeZone($dt_user_timezone);
@aa21
aa21 / instagram_scrape.php
Created June 17, 2016 07:20 — forked from cosmocatalano/instagram_scrape.php
Quick-and-dirty Instagram web scrape, just in case you don't think you should have to make your users log in to deliver them public photos.
<?php
//returns a big old hunk of JSON from a non-private IG account page.
function scrape_insta($username) {
$insta_source = file_get_contents('http://instagram.com/'.$username);
$shards = explode('window._sharedData = ', $insta_source);
$insta_json = explode(';</script>', $shards[1]);
$insta_array = json_decode($insta_json[0], TRUE);
return $insta_array;
}
@aa21
aa21 / instagram-fetcher.php
Created June 17, 2016 07:19 — forked from shahril96/instagram-fetcher.php
Simple Instagram media info fetcher
<?php
/*
* title : simple instagram info fetcher
*
* author : shahril
* receipant : afif zafri
* date : 29-dis-2015
*/
@aa21
aa21 / Bash_commands_etc.sh
Last active May 3, 2016 08:24
Bash Commands & tricks
###### ~/.bash_profile ######
alias a='vim ~/.bash_profile && source ~/.bash_profile'
alias gpp='git pull && git push'
# FIND PROCESS
function p(){
ps aux | grep -i $1 | grep -v grep
}