Category Archives: Bash

Using PhantomJS to request a web page

PhantomJS is a very nice headless browser which uses the WebKit browser engine. It can be used for many purposes. However, I’m going to illustrate PhantomJS by performing a Bing search query and also executing JavaScript code on the page. Libraries such as jQuery can be injected into the page to perform all kinds of [...]

Also posted in JavaScript | Tagged , , , , , , , , , , | Leave a comment

(Bash) Check if a folder exists

 

Posted in Bash | Tagged , , , , | Leave a comment

(Bash) Check if a file exists

 

Posted in Bash | Tagged , , , , | Leave a comment

(Bash) How to check the superuser privileges

 

Posted in Bash | Tagged , , , , | Leave a comment

(Bash) Download Directory with scp

download directory to localhost home folder new-dir-name

Posted in Bash | Tagged , , , | Leave a comment

Assembling with nasm and disassembling with ndisasm

The following commands demonstrate assembling with nasm and disassembling with ndisasm. $ cat example.s mov eax,0 test eax,eax $ nasm example.s $ ndisasm example 00000000 66B800000000 mov eax,0×0 00000006 6685C0 test eax,eax The first column of the disassembly contains the file offset, the second column contains the opcodes and the third contains the assembly instructions. [...]

Also posted in Assembler | Tagged , , , , , , | Leave a comment

(Bash) Extensible match filter example with ldapsearch

Use an extensible match filter to discover entries beneath and including a portion of the DN. Uses the older OpenLDAP ldapsearch syntax and the modern ldapsearch syntax.

Posted in Bash | Tagged , , , , , , , | Leave a comment

(Bash) Search for string in files

 

Posted in Bash | Tagged , , , , | Leave a comment

(Bash) Audio conversion 3gpp to mp3 with ffmpeg

$FFMPEG_HOME/bin/ffmpeg -i rec_1452.3gpp -acodec libmp3lame -ar 22050 audio_only_test.mp3 –stdout   ffmpeg version N-30956-g81ef892, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 22 2011 17:37:00 with gcc 4.5.3 … libpostproc 51. 2. 0 / 51. 2. 0 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘rec_1452.3gpp’: Metadata: major_brand : 3gp4 minor_version : 0 compatible_brands: isom3gp4 Duration: 00:01:27.44, start: 0.000000, [...]

Posted in Bash | Tagged , , , , , , , , , , , , | Leave a comment

(Bash) relay files via tar+ssh+cat

rsync doesn’t like to copy files from host to host. This is sort of the “old school” unix way – tar everything to a pipe, then pipe everything out. It’s how we used to copy directories remotely before we had tools like rsync. I’m definitely open to suggestions on how to improve this (even a [...]

Posted in Bash | Tagged , , , , , , , , | Leave a comment