Mount samba share with command line

When you work with vagrant, you might want your project folder to be mounted on some directory on your local. You can do that easily with file manager, but here’s my favorite way to mount my samba share in vagrant to my directory on my local. So I can work on that.

Before you do this, you might want to get your current user id, so your project is accessible. And make sure the destination directory is already exists.

sudo mount -t cifs -o uid=1001,gid=1001 // /tmp/kripikpasta

Setup nginx, php, wordpress in ubuntu

So after all these years I’ve had using apache for run something that runs with php, but since I know about nginx, I’ve been using this webserver instead of apache.

This wordpress blog is running with nginx and php-fpm, because not like apache that you can run anything about php without install the additional package. With nginx, you’ll need php-fpm to run php behind nginx.

This is the steps that I always use for make my php run behind nginx, especially when I setup this wordpress blog. Since I’m using mysql for database, you might want to install php package for mysql as well.

apt-get install php5-common php5-fpm php5-mysql

create nginx configuration for php website

vim /etc/nginx/conf.d/myweb.conf


server {
    listen 80;
    charset utf-8;
    gzip_vary on;
    access_log /var/log/nginx/myweb.access.log;
    error_log /var/log/nginx/myweb.error.log;
    add_header 'Access-Control-Allow-Origin' '*' always;
    add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE' always;
    location / {
        root /var/www/pulpn;
        index index.php;
        try_files $uri $uri/ /index.php?q=$uri&$args;
        location ~* \.php {
            try_files $uri =404;
            include fastcgi_params;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass  unix:/var/run/php5-fpm.sock;

Restart your nginx :

service nginx restart


/etc/init.d/nginx restart

Jasa pembuatan website Pondok Kelapa

Bagi yang berminat untuk dibuatkan website baik itu berupa blog, eCommerce, company profile, private API,  toko online untuk umum, kerjaan atau tugas kuliah/sekolah, skripsi, silahkan hubungi saya di bawah ini :

Contact: 085814729385 (SMS/Whatsapp)

Alamat: Pondok Kelapa, Duren sawit – Jakarta Timur

Jasa pembuatan aplikasi android Pondok Kelapa

Dump entire photos in Facebook album with Python

Simple dumping photos from albums in facebook by python. in this case, we must got an authorization before dump the albums. first of all, we have to login to the facebook required user and password. afterwards we have to fetching a couples of line called token key which that it’s an authorization key for grab the data.

# -*- coding: utf-8 -*-
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Lesser General Public
#   License as published by the Free Software Foundation; either
#   version 2.1 of the License, or (at your option) any later version.
#   This library is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   Lesser General Public License for more details.
#   You should have received a copy of the GNU Lesser General Public
#   License along with this library; if not, write to the 
#      Free Software Foundation, Inc., 
#      59 Temple Place, Suite 330, 
#      Boston, MA  02111-1307  USA
#   by

import json, random, re
import urllib, urllib2
import sys, os
import cookielib

# Random user-agents
user_agents = [
    'Mozilla/5.0 (Windows; U; Windows NT 5.1; it; rv: Gecko/20071127 Firefox/',
    'Opera/9.25 (Windows NT 5.1; U; en)',
    'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)',
    'Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.5 (like Gecko) (Kubuntu)',
    'Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070731 Ubuntu/dapper-security Firefox/',
    'Lynx/2.8.5rel.1 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/1.2.9'

# Facebook photo dumper
class _fbphotosdumper_(object):
	def __init__(self, user, pswd, album_name):
    		self.dictid 	= {}
    		self.count 	= {}
    		self.user 	= user
    		self.pswd 	= pswd
    		self.album_name = album_name
    		self.value 	= {'post_form_id' : '42d7f2c5ff3976d42ead29cbda1561ec',
                  	           'pass' :pswd}
    		self.home 	= ''
    		self.url 	= ''
    		self.cj 	= cookielib.CookieJar()
    		self.opener 	= urllib2.build_opener(urllib2.HTTPCookieProcessor(self.cj))
  	def login(self):
    		login_data 		= urllib.urlencode(self.value)
    		self.opener.addheaders 	= [('User-agent', random.choice(user_agents))],login_data)

	# Doesn't need profile id, this is token rules. Get token key from
  	def get_token(self):
    		url_api ='')
    		rurl_api =
    		get ='access_token=(.*)">',rurl_api)
    		if get:
  	def get_albums(self):
    		url_album 	=''%(self.get_token()))
    		rurl_album 	=
    		_albumfilter_ 	= json.loads(rurl_album)
    		for i in _albumfilter_['data']:
        			name 	= i['name']
        			albumid = i['id']
        			psum 	= i['count']
        			self.dictid[name] = albumid
        			self.count[name] = psum
        			#return name,psum
  	def get_photos(self):
    		sys.stdout.write('Downloading %s photos from "%s" album\n'%(self.count[self.album_name],self.album_name))
 	   	url_photos =''%(self.dictid[self.album_name],
    		rurl_photos =
    		_photosfilter_ = json.loads(rurl_photos)
    		image = urllib.URLopener()
    		for x in _photosfilter_['data']:
	      			link = x['source']
      				print link.split('/')[-1],'Saved in "%s"'%(current)
			except KeyboardInterrupt:
				sys.stdout.write('Download interrupted\n')
def main():
	global current
	if len(sys.argv) == 4:
		# Create a directory for fetched images from facebook album
		folder= 'Facebook Album - %s'%(sys.argv[3])
		current = os.getcwd()+'/%s'%folder
		os.system('mkdir "%s"'%folder)#"%s"'%folder
		facebook = _fbphotosdumper_(sys.argv[1],sys.argv[2],sys.argv[3])
			print 'Login Error'
			print 'No album named "%s"'%(sys.argv[3])
		print 'Facebook Photos dumper'
		print '----------------------------------------'
		print 'Usage\t: %s user pswd "Album name"'%sys.argv[0]
		print 'Example\t: %s fubar "Foo Bar"'%sys.argv[0]
if __name__ == '__main__':

Get your favorite manga downloaded with Perl’s Manga Downloader 0.2

It just stupid script to download manga comic, you might want to change the website.

#!/usr/bin/perl -w
# -*- coding: utf-8 -*-
#| Manga Downloader v0.2                    |
#| code by             : muffat19           |
#| bugs & suggestions  : |
#+ -----------------------------------------+

use LWP::Simple;
use Cwd 'chdir';

# Get title

sub get_title {
	my $base_url = get("");
	$base_url =~ /\d+\/$ARGV[0].html/;$manga_id = "$&";
	my $base_manga = get(lc("$manga_id"));
	$base_manga =~ / $ARGV[1]<\/a> : \D+<\/td>/;$data = "$&";
	$data =~ s/ $ARGV[1]<\/a> : //;
	$data =~ s/<\/td>//;
	print "$data\n";

# loop for retrieve image

sub fetching_manga {
	$numb = 1;
	my $base_url    = get("$ARGV[0]/$ARGV[1]/$numb") 
		or print("invalid manga\n") and exit 0;	
	my $page_find   = '</select> of';
	my $page_search = index($base_url, $page_find);
	$parse_page 	= substr($base_url, $page_search,28);
	$parse_page 	=~ s/of..*\<\/div>\s/ /gi;$num_re = "$&\n";
	$num_re 	=~ m/(\d+)/;$page = "$&";

	# Manga found, continue for download

	print "==========================================\n";
	print "Chapter Available\n";	
	print "Manga   : $ARGV[0]\n";
	print "Chapter : $ARGV[1]\n";
	print "Title   : ";get_title;
	print "Pages   : $page\n";
	print "==========================================\n";
        print "Download this chapter [y/n]: ";$option = <STDIN>;
        if (($option eq "y") || ($option eq "Y")) {
         	system("mkdir $ARGV[0]-$ARGV[1]"); } 
	else {
		exit 0; }	 
	$dir = "$ARGV[0]-$ARGV[1]";
	for ($numb = 1; $numb <= $page; $numb++) {
		my $base_img   = get("$ARGV[0]/$ARGV[1]/$numb");
		my $img_search = 'imgholder';
		my $result     = index($base_img, $img_search);
		$gw 	       = substr($base_img, $result,250);
		$gw 	       =~ s/http:\/\/..*\.jpg|png\s/ /gi;$img = "$&";
	if ($numb < 10) {
                chdir $dir;
		print "Saving 0$numb.jpg\n";
	} else {
		chdir $dir;
                print "Saving $numb.jpg\n";

# Create parameters

$num = $#ARGV + 1; 
if ($num != 2) {
        print "Perl Manga Downloader v0.2\n";
	print "Usage : $0 manga chapter\n";
	exit 0; }
else {
	print "Checking $ARGV[0] Chapter $ARGV[1]\n";fetching_manga;