Author Archives: zam

Flatten a Nested Directory & File Hierarchy from Command Line of OS X

Lets say you have this kind of file/folder structure:

You can take all the *.jpg file or any file type, and move it into one folder.
Here are the command to use:

Upgrade Python packages at using pip

As you read in the title above; to update your python packages via pip:

for Linux/*nix:

p/s: you may need to run as sudo. Probably.

for Windows:

Credit: http://stackoverflow.com/questions/2720014/upgrading-all-packages-with-pip

Fixing wp_termmeta doesn’t exist error

One day, I open my mailbox and see bunch of error mail written something like this:

Upon diving in Google ocean, I found this solution that may solve the problem:

Use this SQL query to add manually the wp_termmeta table in your WordPress database if there is the wp_termmeta table doesn’t exist in your DB.

Credit: http://zanca.it/tutorials/wp_termmeta-doesnt-exist-error-solved/

Install more command line utils for Terminal app in IOS

In case you wonder how to use command line utils like ifconfig or netstat in you IOS devices (iPhone), install this package via Cydia:

adv-cmds – finger, fingerd, last, lsvfs, md, ps
diskdev-cmds – mount, quota, fsck, fstyp, fdisk, tunefs
network-cmds – arp, ifconfig, netstat, route, traceroute
shell-cmds – killall, mktemp, renice, time, which
file-cmds – chflags, compress, ipcrm, ipcs, pax
system-cmds – iostat, login, passwd, sync, sysctl
basic-cmds – msg, uudecode, uuencode, write

Credit : http://forums.whirlpool.net.au/archive/1718105

Shell script fails: Syntax error: “(” unexpected

The error when executing the bash code:

The script does not begin with a shebang line, so the kernel executes it with /bin/sh. On Ubuntu, /bin/sh is dash, a shell designed for fast startup and execution with only standard features. When dash reaches the line, it sees a syntax error: that parenthesis doesn’t mean anything to it in context.

Since dash (like all other shells) is an interpreter, it won’t complain until the execution reaches the problematic line. So even if the script successfully started at some point in your testing, it would have aborted once the problematic line was reached.

The shebang line must be the very first thing in the file. Since you use bash features, the first line of the file must be #!/bin/bash or #!/usr/bin/env bash.

Credit: http://unix.stackexchange.com/questions/45781/shell-script-fails-syntax-error-unexpected

Python Error – InsecurePlatformWarning

There is one time I see this kind of error:

If you’re on ubuntu, you may run into trouble installing pyopenssl, you’ll need these dependencies:

You only need to install the security package extras:

or, install them directly:

Requests will then automatically inject pyopenssl into urllib3

Credit: http://stackoverflow.com/questions/29134512/insecureplatformwarning-a-true-sslcontext-object-is-not-available-this-prevent

Python Error – ImportError: No module named pkg_resources

There is one time I tried to install some python package via pip install requirement. But I encountered some error like this:

To fix the issue, run the setup script for setuptools:

Yeah. it solve my problem. Probably. XD

Credit: http://stackoverflow.com/questions/7446187/no-module-named-pkg-resources

Fix Locale problem on Ubuntu

Recently, I saw this kind or error quite frequent. At first I thought that it was nothing.
But eventually, it’s kinda bothering me when I see the error message. :p

So, here is the solution to solve this problem.
First, run this command:

It updates /etc/default/locale with provided values.

If you see the /etc/default/locale file, it shows something like this:

If the problem still occur, maybe you can try this first before running the command above again:

Credit to http://askubuntu.com/questions/162391/how-do-i-fix-my-locale-issue/505424#505424

Installing bulk_extractor on Mac OS X

All reference is taken at here: https://github.com/simsong/bulk_extractor/wiki/Installing-bulk_extractor

bulk_extractor is a computer forensics tool that scans a disk image, a file, or a directory of files and extracts useful information without parsing the file system or file system structures. The results can be easily inspected, parsed, or processed with automated tools.

To install bulk_extractor, first install required library via Macports:

All install dev library:

Download libewf source code:

Then install libewf from source (because libewf via ports too old):

SNMP Cannot Find Module on Ubuntu 14.04

If you encounter error something like this:

Then, where are in the same path. Path where we searching for the answers. XD
So, here is the solution to solve this error.

First, edit this sources.list file:

add this line to the end of file:

:w to save and :q to exit vi editor

Then, install this packages:

And then run this:

Voila! Done. Hope it helps. 🙂