Nice web scraper to get a listing of all 4chan threads on a certain board.

This is a nice web scraper that will read a 4chan board and return a listing of all threads on that board page. This could be very useful code to expand into a useful script. #!/usr/bin/env bash   set -e   links=( $( wget "$@" -qo /dev/null -SO – | grep -oE ‘</span><a href=\"thread\/[0-9]+\"’ | … Read more

Use sed to filter text, this is very useful.

This sed sample will filter out all HTML opening and closing tags in HTML sed -e ‘s/<[^>]*>//g’ blog.txtsed -e ‘s/<[^>]*>//g’ blog.txt This is an example of the usage of this one-liner. 4.4 Sun Nov 11 jason@Yog-Sothoth 0: $ sed -e ‘s/<[^>]*>//g’ index.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">   Securitron GNU/Linux pages.   … Read more

Copy files from one place to another with dd. This is a good way to write an ISO to a USB drive or just to another place.

The dd utility may be used to copy a file from one place to another, this is good to copy a ISO file to a USB thumb drive. This parameter is good for getting feedback about how long a file copy is taking, this is good if it is a big file. bs=4M oflag=direct,dsyncbs=4M oflag=direct,dsync … Read more

Get information about the routing table on a mac computer.

This simple command will print the routing table from a Mac computer. deusexmachina:~ jason$ netstat -nr Routing tables   Internet: Destination Gateway Flags Refs Use Netif Expire default 192.168.1.1 UGSc 69 0 en0 127 127.0.0.1 UCS 0 0 lo0 127.0.0.1 127.0.0.1 UH 2 120 lo0 169.254 link#4 UCS 0 0 en0 192.168.1 link#4 UCS 0 … Read more

What a file hardlink means on Linux. And why symlinks are better.

Linux supports the creation of file hardlinks. This is a copy of a file that has the same inode as the original. If the copy is edited, the original is too. 4.4 Thu Oct 04 jason@Yog-Sothoth 0: $ ln missile.jpg missilenew.jpg 4.4 Thu Oct 04 jason@Yog-Sothoth 0: $ ls -hula -i -1 total 264K 14885009 … Read more

My system information program I coded for Linux a while ago. This works very well.

https://github.com/john302/sysinfo. This is my system information program I coded for Linux. This gives a bit of information about your Linux system. Just check out the source and type make to compile. Here is some sample output. 13:21:02 ~/Downloads/sysinfo.kdevelop-1.0 homer@neo $ ./sysinfo 1 –System name – Linux –Nodename – neo.deusexmachina –Release – 3.9.5-301.fc19.x86_64 –Version – #1 … Read more

How to use Google search in a web browser. This is a bash styled shell for Google searches.

Check this website out: http://goosh.org/. This website allows you to perform Google searches using a command line like bash. Just type a search query at the command line and the results will be displayed to STDOUT. Here is an example: [email protected]:/web&gt; linux shell 1) Linux Shell Scripting Tutorial – A Beginner’s handbook – FreeOS.com Table … Read more

Very useful bash PS1 prompts.

A very colorful example that will really stand out. 4.4 Wed Aug 29 jason@Yog-Sothoth 0: $ Here is the code for this example. export PS1="\[\033[38;5;39m\]\v\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;83m\]\d\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;201m\]\u\[$(tput sgr0)\]\[\033[38;5;196m\]@\[$(tput sgr0)\]\[\033[38;5;51m\]\H\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;82m\]\l\[$(tput sgr0)\]\[\033[38;5;15m\]: \\$ \[$(tput sgr0)\]"export PS1="\[\033[38;5;39m\]\v\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;83m\]\d\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;201m\]\u\[$(tput sgr0)\]\[\033[38;5;196m\]@\[$(tput sgr0)\]\[\033[38;5;51m\]\H\[$(tput sgr0)\]\[\033[38;5;15m\] \[$(tput sgr0)\]\[\033[38;5;82m\]\l\[$(tput sgr0)\]\[\033[38;5;15m\]: \\$ \[$(tput … Read more

Very nice bash PS1 prompts.

A complex, but very useful bash shell prompt. PS1=$( sep=$'\xC2\xBB' # UTF-8 U+00BB red=$(tput setaf 1) green=$(tput setaf 2) yellow=$(tput setaf 3) blue=$(tput setaf 4) cyan=$(tput setaf 5) bold=$(tput bold) reset=$(tput sgr0) [[ $EUID -eq 0 ]] && user=$red || user=$green echo "\[$user\]\u@\h\[$reset\] \[$blue$bold\]$sep\[$reset\] \[$yellow\]\W\[$reset\] \[$blue$bold\]$sep\[$reset\] \[$user\]\$\[$reset\] ") Gives the user a prompt that looks … Read more

how to generate long random numbers with the Linux command line.

This simple command prints out a long random number string from /dev/urandom. jason@Yog-Sothoth » img » $ tr -dc "[:digit:]" < /dev/urandom | head -c 64 ; echo 9958048462925775253231939134565711861924198983498274782350446110 Do it this way to remove the newline after the output. This would be good for use in a script. jason@Yog-Sothoth » img » $ tr … Read more

How to have a custom bash prompt that changes when you are in a certain folder.

This is how to create a custom bash prompt that will change if the user is in a certain folder, but is standard anywhere else. PS1="┌─╼ \$(if [[ \$PWD/ = \$HOME/anime/* ]]; then \ echo \"\[\e[1;35m\](\[\e[0;35m\] •\[\e[1;35m\]^ ω ^) \[\e[1;34m\]\$(pwd | sed ‘s|’$HOME/anime/’|アニメ |; s|’$HOME/anime’|アニメ |’)\[\e[0m\]\" \ ; else \ echo \"\[\e[0;35m\]\u\[\e[1;36m\]::\[\e[0;32m\]\h \[\e[1;34m\]\w\[\e[0m\]\" \ ; … Read more

How to get WIFI information with the command line.

It is very easy to get information about wireless networks with the command line. This example uses iwlist to view the information we need. jason@jason-Lenovo-H50-55:~$ sudo iwlist wlan0 scan | grep ESSID ESSID:"OPTUS58FFG69" ESSID:"TelstraD22F23" ESSID:"OPTUS58FFG69" ESSID:"TelstraD22F23" ESSID:"OPTUS_B8E926"jason@jason-Lenovo-H50-55:~$ sudo iwlist wlan0 scan | grep ESSID ESSID:"OPTUS58FFG69" ESSID:"TelstraD22F23" ESSID:"OPTUS58FFG69" ESSID:"TelstraD22F23" ESSID:"OPTUS_B8E926" This is very good for listing … Read more

Very cool Linux text processing tricks.

Align all text right on an 80 column width. jason@jason-Lenovo-H50-55:~/Documents$ ls -hula | sed -e :a -e ‘s/^.\{1,80\}$/ &/;ta’ total 872K drwxr-xr-x 2 jason jason 4.0K May 4 08:48 . drwxr-xr-x 23 jason jason 4.0K May 3 20:51 .. -rw-r–r– 1 jason jason 848K Apr 21 13:01 altis_insurgency_altis.pbo -rwxrwxr-x 1 jason jason 166 Apr 22 … Read more

Image manipulation with the Linux shell.

Emulate a Polaroid photo with the imagemagik package on Linux. convert lifeinCanberra_bg.jpg -polaroid 0 house.jpgconvert lifeinCanberra_bg.jpg -polaroid 0 house.jpg This is the original image. https://www.asis.gov.au/media/Images/Rebrand/lifeinCanberra_bg.jpg. And this is the image after manipulation. Double the size of an image, while retaining relatively good image quality. convert missile.jpg -magnify missilebig.jpgconvert missile.jpg -magnify missilebig.jpg Take a screenshot of … Read more

A useful posting explaining why Linux does not need defragmenting.

If you are interested in how the Linux filesystem works, then this is a posting you really need to read: http://geekblog.oneandoneis2.org/index.php/2006/08/17/why_doesn_t_linux_need_defragmenting. This is a posting explaining how the Linux filesystem stores file and why it does not need to defragment the filesystem as it stores files more efficiently. I have never wanted to defragment a … Read more

How to have a nice text banner associated with your Linux user account.

Your Linux user account details may be seen with the finger command, i.e finger jason. But the user can add more information to this as well. Create a file in your home directory named .plan and put this into it. ***************************************************************************^M NOTICE TO USERS     This computer system is the private property of its … Read more