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 / NodeJs
Last active September 2, 2015 04:44
# Serve Static Files from public folder
app.use(express.static('public'));
# Serve "public" folder's files as Static Files from path "/static"
app.use('/static', express.static('public'));
# Hosting apache & NodeJS on same server
<VirtualHost *:80>
ServerName bms.komiapp.com
ProxyPreserveHost on
Blockchain
- Anything that can be mathematically represented
- can be modelled
- secured
- traded
Privacy:
- Info, Identity, Funds are private
Contract: Program that runs everytime a message called a transaction is received
@aa21
aa21 / mongodb
Last active September 21, 2015 02:16
#installing mongodb
vim /etc/yum.repos.d/mongodb.repo
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
yum install mongo-10gen mongo-10gen-server
chkconfig mongod on
@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 / books.md
Last active October 1, 2015 07:28
Coding Books etc
@aa21
aa21 / vim.vim
Last active January 20, 2016 05:54
# Learn Vim Fast
https://robots.thoughtbot.com/the-vim-learning-curve-is-a-myth
# VIM Tutorial
http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html
# Derek Wyatt's awesome vim series
http://vimeo.com/user1690209/videos
# Vimcasts
@aa21
aa21 / Regex
Created January 19, 2016 04:22
# Word not in string
^((?!cat).)*$ <-- Match sentence not containing 'cat'
@aa21
aa21 / git.git
Created January 26, 2016 08:45
Git stuff
-- ignore changes to local file, db, config etc.
git update-index --assume-unchanged [<file>...]
.git/info/exclude
.gitignore
@aa21
aa21 / instagram-fetcher.php
Created June 17, 2016 07:19 — forked from shahrilnet/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 / 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;
}