gt—create a gedit scratchpad


I am really lazy with my editors. I have aliases in my shell configuration for gedit and vim to open them as quickly as possible:

alias v="vim -p"
alias sv="sudo vim -p"
alias g="bgcmd gedit"
alias sg="bgcmd gksudo geany"

This is very nice for me because I use my editors quite a bit. One thing I needed though was a command that would create and open a temporary file in gedit. The main reason for this is that, there are times, I don’t know how to name or place the file properly yet. At other times, the reason is, I like to have a scratchpad that would save information that I might forget if it was just a new file and I forgot about it or a crash happened.

The bash script

Running gt will create and open a file named with the current time (MMDDhhmm) and will be saved in the trash folder. If gt is followed by a name (e.g. gt the name will be appended to the time.


The name is helpful if wanting to dig the file out of the trash folder at a later time.

# (g)edit (t)emp. file — create gedit scratchpad

tme_day=$(date +%m%d%H%M)

[ ! -d "$tmp_dir" ] && mkdir -pv "$tmp_dir"

# gedit existence test
hash gedit 2>&- || { echo "Requires program \"gedit\"."; exit 1; }

# Usage
if [ "$1" = -h -o "$1" = --help ]; then
  echo "${0##*/} [name1] [name2*] — create a gedit scratchpad"
  exit 2

if [ "$1" ]; then
  for name in "$@"; do
    nohup gedit "$tmp_dir"/"$tme_day"-"$name" &> /dev/null &
  nohup gedit "$tmp_dir"/"$tme_day" &> /dev/null &

Write The Fine Manual with pod2man

Disclaimer: This is a guide for basic manual writing. It uses a simple markup language and converter to create a manual. It is good for beginners. For a good general overview of man pages read this, for more common approaches to writing manuals read this post.

An example

To get a good idea of how to write a manual seeing the markup of a POD (Perl’s Plain Old Document) works well. This is a POD for a fictitious program called dr-smile:

=encoding UTF8

=head1 NAME

dr-smile — output platitudes to help to improve one's mood


dr-smile [B<--happy>] [B<--joke>=F<type>]


B<dr-smile> outputs jokes and happy thoughts designed to make one feel F<--better>. It has the ability to output pleasant thoughts, jokes, good memories, optimistic fortunes, or just give you a big hub. B<dr-smile> is for I<entertainment> and for light mood change requirements. Please use responsibly and with greater change requirements please see an appropriate professional. Additional options are available in the configuration file F</etc/dr-smile.conf>.

=over 4

=item B<-h>B<--happy>

A general happy thought will be output (e.g. C<dr-smile --happy>).

=item B<-j> F<type>B<--joke>=F<type>

A good-sense joke will be told.  The types are: F<knock> and F<oddball>.  Read more in B<jokes(1)>.


Text formatting

Man pages are mainly created with these types of formatting:

Format Markup
bold B<text>
italic I<text>
link L<http://address.domain >
file name F<file-name>
email E<name@address.domain>

Note: E<> is technically for escapes, however, I have seen it used before in another pod2man document—whether intentional or not I am not sure. Read the manual perlpod for markup information.

From a general observation over the years, bold and italic formatting get used in these situations:


  • program names
  • options
  • other manuals


  • keywords
  • emphasis
  • arguments
  • occasionally manuals

Category formatting

Manual page categories are generally formatted with a certain order. The order of categories vary a bit per man page but the first four are usually present. Here is the general structure and their purpose

  The name of the command followed by a one-line description of what it does.
  A command's invocation with its listed options, or a functions parameter listings with its header file.
  An in-depth explanation of the command or function.
  A explanation(s) of what an option does these are sometimes put in the DESCRIPTION.
  Some examples of common usage.
  Files related to the command or function.
  List of known bugs.
  A list of referenced or related commands.
  Information about the author...

For how to create the categorical entries, I only know the basic formatting. Look at the above example to see how it is done.

  • Category begin is defined with the head1 tag.
  • Indenting is done with the over 4 tag.\
  • Category item is defined with the =item tag.
  • Category end to define a new category is done with the =back tag.

Document to manual conversion

pod2man usage is basic. First look at manual section definitions here to know what section it should belong to. For my miscellaneous, fictitious program:

pod2man dr-smile.pod > dr-smile.7

Additional information may be wanted to add to the manual along with compression:

pod2man --section=7 --center="General Commands Manual" --release="1.0" \
dr-smile.pod | gzip > dr-smile.7.gz

To view the man page use man -l dr-smile.7.gz.



xuserrun—run a command as the currently active server user

xuserrun is a bash script to detect the first server environmental values, these values are then used to transmit a command to it. The script is primarily useful from another environment: a different user, from the tty console, from cron, a boot script…. xuserrun requires systemd.

Running it is basic:

xuserrun xclock -digital

Another example:

xuserrun notify-send "Remember to get bread."

I have put it in its own repository.

Audio file encode to a video file

I wanted to convert an MP3 file to a video file to be able to use it on my PS3. The PS3 has an audio player but it doesn’t remember the position. It was an audiobook so it was best for me to convert it to a video file.

# Create video file from audio file.

# Required programs.
if ! hash ffmpeg 2>&- ; then
  echo "Requires program: ffmpeg"; exit 1; fi

# Usage.
if [ $# != 2 ] ; then
    echo "${0##*/} <image> <audio> - create video file from an audio file."
    exit 1; fi

# Files existent test.
if [ ! -f "$1" ] ; then
    echo "non-existent image: "$1""
    exit 1; fi
if [ ! -f "$2" ] ; then
    echo "non-existant audio: "$2""
    exit 1; fi

ffmpeg -f image2 -loop 1 -i "$1" -i "$2" -c:v libx264 -tune stillimage 
  -c:a copy -strict experimental -shortest "$vid_nme"

#ffmpeg -f image2 -loop 1 -i "$1" -i "$2" -c:v libx264 -tune stillimage 
#  -c:a aac -strict experimental -b:a 192k -shortest "$3".mp4

Monitor Hardware Calibration


A calibrated monitor will help images feel more natural and will help ease eye strain with tasks like reading. It may be preferable to some that when a new monitor is acquired to have it calibrated. This is a guide to show how to do such.

My Experience

I read documents on my computer all the time and occasionally do graphic design work. I appreciate having a calibrated monitor. I have a background in developing color photography which has helped my eye to recognize correct image reproduction. I have also worked for computer laboratories that has allowed me to calibrate a good number of varying monitors. Others will know more than me, however, this should be a good layman’s approach.

Monitor Setup Knowledge

  • the monitor should be left on ten+ minutes to let the bulb warm up to its standard operating color
  • the monitor’s angle at which it is viewed is important, for older or less expensive monitors a non-direct view of a few degrees can effect the display image… angle the monitor so that it is perpendicular to the eyes
  • hardware calibration should come before any software calibration, and software calibration only when necessary… hardware calibration would be helped if software calibration were disable beforehand
  • some monitor controls are extracurricular, eg better flesh tone or crushing black levels… for initial setup these controls should be turned off
  • some images are scalable so they can be view accurately at full screen, I would recommend doing so to help with one’s attention

Gamma Correction

Gamma Correction is an adjustment of the mid-luminosity level of the bulb to correct for a light source that is unique (ie not the sun) that the natural eye adjusts to non-linearly. A monitor that needs Gamma Correction the display will look light and glowy; excessive Gamma Correction will look dark and over-saturated. Most monitors today use the 2.2 sRGB Gamma Correction standard.

The test image displays four channels for setting Gamma Correction: a composite, red, green, and black. This image will need to be viewed in its original size, ie 100%, for it to work correctly.

Some monitors have Gamma Correction controls; for others it may be tied to the RGB controls… and some monitors will require to have it set with a software program. Adjust the controls up and down and match the circle luminosity to the surrounding area.


If changing the RGB controls do not effect gamma, I would recommend a software calibrator; proper gamma correction is essential to proper monitor output. For Linux xgamma can be used, and Windows has its own calibration tool. (As a side note: this test works because the brain averages the black and light lines of the background to an aggregate luminosity; the circle is a 73% luminosity.


Contrast, sometimes called Picture or White Level, defines the luminance range of a monitor. A contrast that is high would have lightness-values extended to black or white; a contrast that is low would lightness-values toward middle grays.

The test image displays columns of circles with increasing lightness toward the center of the image. The center circle has a lightness of 254/255; the background is a pure white of 255.

Begin the test by turning down the contrast to zero, then turn it up until circles begin disappearing; turn down the contrast again until the most inner-most circle that is capable of being displayed is displayed. This defines the maximum contrast. The monitor might only be able to display some of these upper contrasts, an acceptable amount I am told is the 245 of 255 range (the third outer-most circle). For certain monitors high contrasts values may alter the temperature of the bulb.



Brightness refers to the power level of the bulb, its physical brightness. Black level refers to black reproduction, or more elaborately the accuracy of displaying the lowest shades of black. The brightness setting may have an effect on both.

The test image displays columns of circles with decreasing lightness toward the center of the image. The center circle has a lightness of 1/255; the background lacks lightness of 0/255.

Begin the test by turn up the brightness to 100, then turn it down until circles begin disappearing; turn up the brightness again until the inner-most circle that is capable of being displayed is displayed. This defines the minimum brightness.

For brightness, I like to recommend reading light level. A good light to read a book with is a good light to read from the screen. What feels comfortable to the eye is usually better.


Black should be black and the shades near it are nice if visible too. A lower value acceptable for this is probably 10/255 again. If turning the brightness down has no effect on the black level visibility, leave it at the top or what is comfortable to the eye.

Color Balance


Fine tuning color balance can take years of practice to develop a trained eye–reds can look purple, cyan can look green…

The test image displays a variety of grays. If the images lacks the feel of being gray, adjust the RGB controls from 100 down to fix. Play with the controls up and down and get a feel for the color. Our eyes naturally adjust to the conditions they are in so this test can take time to learn how to do well. Periodic breaks can help reset the eyes. To fine tune the color, more can done later with the overall image, also the Gamma Correction test image can be of help adjusting color.


Fine Tuning

neutral chroma-free gray scale. This is the most critical component of monitoring and is accomplished through a White Balance Adjustment–Bennet Cain

After all the controls have been set I recommend going back and fine tuning them if necessary. I have been told that flat-panel monitors controls function independently. This means that one controls adjustments effect only that control—for CRT monitors control settings were dependent meaning that other controls could be effected by another control. To be sure of one’s settings though it is good to go back and check that all the control settings feel right.

Below is the skin tone test which works well for an additionally test to determine color balance. Skin tone is a good test for image reproduction.


Software Calibration

Fine-tooth calibration of a monitor through software calibration can help a monitor display more accurately. Otherwise, software calibration should be avoided–it is a second level adjustment and inaccurate at that. Software calibration, for example, can look like it is bringing in those blacks that the monitor originally could not display, but what it is doing making a two black in to a ten black. Software calibration also is a dependent control; for example, adjusting brightness with a software calibrator will effect contrast. The only acceptable software calibration to me is Gamma Correction and EDID.

EDID information is supplied in the monitor’s ROM. It contains information representing how accurately the monitor is able to produce color and lightness. EDID information is meant to be grabbed by the Operating System and used as an ICC profile to better render the display and share color information with other devices.

Software Video Players and the Plunging PLUGE Line

CRT monitors, generally for television, if setup deliberately for video production, used PLUGE controls to “black-crush” the bottom 7.5 IRE (7.5% visible luminance spectrum). This could have been done originally because early CRT monitors had difficulty displaying this value or possibly it was done for dramatic effect; I have yet to learn why. Some DVD players are able to produce an IRE below 7.5. It may be necessary to calibrate a “black-crush” on the software video player to render videos correctly.

To Do

  • Use an ffmpeg Command to Create Video from Images

See Also

Architectural Intent – a Wallpaper Tile

I tend to use my desktop as my workspace so I like wallpapers that act as more of a background decoration rather than elaborate artwork. So I created this. This is based on a wallpaper I found on the net (sorry, can’t remember where) and I re-did it. The original was in jpeg format and it had a bit of dithering to it.

It’s real basic, just 140×140, but I tile it and it comes out real nice:

It’s a vector image so it’s able to be resized real easy if need be.

Disk and Memory Usage Scripts

At times I like to check my levels of disk and memory usage and it’s more available for me at times for me to do it from the command line. Therefore, I created two scripts for them:

$ devtop 
Filesystem  Size  Used  Avail  Use%  Mounted
/dev/sda1   291G  101G  187G   36%   /
/dev/sda2   166G   38G  121G   24%   /home

$ memtop
PROGRAM          %MEM  #MEM
firefox          14.0  1049.7 MiB
gnome-shell      2.2   165.84 MiB
thunderbird      1.9   143.773 MiB
gedit            0.8   63.8555 MiB
nautilus         0.6   44.9961 MiB
Xorg             0.5   38.5039 MiB
gnome-terminal-  0.3   28.8164 MiB
keepassx         0.3   27.6406 MiB
tracker-extract  0.2   21.1992 MiB

Both script are part of my genscripts-git that is in the Arch Linux User Repository.

Regular videos convert for PSP viewing

I like to put videos on my PSP` to watch later. To be able to remember the options I put this in a bash script.

pspvidconv [-d*] <dir.*> <video(s)> — convert videos to PSP

The PSP allows the creation/use of a supplementary single-depth directory. The directory option (-d) will ask if the user wants to create a new directory, if the answer is no, it will present the existing folders.

# Convert videos to PSP

# Settings
vid_dir=/run/media/$USER/PSP/VIDEO  # For Gnome 3, Gnome 2: /media/PSP/VIDEO
vid_vcd="-vcodec mpeg4 -vtag xvid"  # Video codec: xvid
vid_vcd="-vcodec libx264"           # Video codec: x264
vid_vcd="-vcodec h264"
vid_res=320x240                     # 320x240 for PSP 1001, 480x272 for 2001
vid_vbr=768k                        # Video bit rate, was 1024
vid_vfr=29.97                       # Video frame rate
vid_acd=aac                         # Audio codec to use (libfaac for some)
vid_aab=64k                         # Audio bit rate
vid_aar=48000                       # Audio sampling frequency
vid_aac=2                           # Audio number of channels

# Usage
if [[ -z "$@" ]]; then
  echo "${0##*/} [-d*] <dir.*> <video(s)> — convert videos to PSP"

# Check that PSP is plugged in
if [ ! -d $vid_dir ]; then
  echo "It appears that the PSP is not plugged in, no "$vid_dir"."

# Use sub-directory
if [ "$1" == "-d" ]; then
  while true; do
    read -p " Create a new directory? (y/n): " yn
    case $yn in
      [Yy] )  read -p " Directory name (no spaces): " newdir
              mkdir "$vid_dir" && break 2;;
      [Nn] )  printf " Select PSP VIDEO sub-directory:n"
              select vid_sub in "$vid_dir"/*/
                  test -n "$vid_dir" && break 2
                  echo " Select 1, 2, ..."
                done ;;
      * )     echo " Answer (y)es or (n)o."

# Check if selection(s) exists
for vid in "$@"; do
  if [ ! -f "$vid" ]; then
    echo " Selection ""$vid"" does not exist."

# Convert, save to PSP video directory
for vid in "$@"; do
  vid_out="${vid/:/-}"            # ffmpeg not allowing outputs of ':', '?'
  vid_out="${vid_out/?/}"        #
  #vid_out="${vid_out%.*}"-PSP.mp4 # Append '-PSP' to filename
  # Encode video
  ffmpeg -i file:"$vid" $(printf '%s' "$vid_vcd") -s "$vid_res" -b:v "$vid_vbr" -r "$vid_vfr" -acodec "$vid_acd" -b:a "$vid_aab" -ar "$vid_aar" -ac "$vid_aac" -f psp -strict -2 -y "$vid_dir"/"$vid_out"
  # Create thumbnail
  ffmpeg -i file:"$vid" -f image2 -ss 50 -vframes 1 -s 160x120 "$vid_dir"/"$thm_out"
done && aplay "$fns_snd"

Pandoc-flavored markdown: Perfect!

I’d been looking for a way to convert my notes to webpages. Typically I wrote my notes in .txt form and then went through them and added links, formatting… when I was ready to blog them. Recently, I had asked StackOverflow if I could convert MediaWiki format to HTML. I’m an Administrator for the Arch Wiki so I’m very familiar writing this format. This is when I learned about pandoc. Pandoc’s author describes pandoc as, “If you need to convert files from one markup format into another, pandoc is your swiss-army knife…“.

Plain Text Example

I planned to write my notes in mediawiki format and then convert to HTML, however I’d been using StackOverflow lately and started to learn Markdown Prose and really like it. Markdown’s is designed to be easy to write and read: “Markdown is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML)“. Markdown is so easy to write that it makes sense that sites like StackOverflow and GitHub are using it.

Markdown, Markup Languange

Pandoc has extended markdown to use code blocks ```, tables, and a few other things and converting is very basic:

pandoc -o file.htm

I’m in love, I’m in love, I’m in love :), as it will save me a good bit of time in editing/creating Documentation. Tomorrow, I’ll post a bash script to clean up the HTML to be able to put it in a WordPress Blog.

(ar)ch (pa)ckages – a generic package tasks script for Arch Linux

I once saw a wrapper-script for pacman in the forums that was basically a short-hand version of common pacman tasks. I thought this was a good idea and over the last couple years, I’ve expanded on it. It does just about everything I need it to. It’s real basic and I call it arpa. Here is a basic synopsis:

arpa [option] [*package] - a generic package tasks wrapper script
  -e, --explicit - install a package as explicit
  -g, --get      - get/download package upgrade(s)    : -G get pkg upgrades all
  -i, --install  - install a package                  : -I install as dependency
  -l, --list     - list package files                 : -L list pkgs installed
  -o, --owns     - owning package of a file
  -q, --query    - query for an installed package     : -Q query w/ description
  -r, --remove   - remove a pkg and its deps          : -R force, no argue orphs
  -s, --search   - search for a package               : -S search w/ description
  -u, --upgrade  - upgrade system                     : -U upgrade AUR
  -y, --sync     - sync package db

Good for me to have this around so I can remember everything :), and it is in the AUR.

Acer Aspire 5560G-7809 Laptop: A Gamble Worth Taking

Typically it hasn’t been recommended to buy an Acer, at least in my circles. From the surveys I’ve seen generally Acer rankings are last of the major computer manufacturers. Astonishingly they rank close to the top of units sold. When I saw this, I deduced that Acer likely made possibly shabby computers sold at basement-prices to a portion of the population that was virgin. So I’m not sure what I was thinking when I bought my Aspire laptop except, “If that’s true, thats a really good price; I have to have it.” I had been using a ten-year-old laptop up to now so this was by best shot to the moon orbit.

I heard about laptops that were “Desktop Replacements”. I was hoping to find something in that area: a powerful-ish core in a mobile unit (with a decent gaming card). I’m not sure the Aspire 5560G-7809 [1][2] would qualify as one officially but performance in Windows and Linux is good (at least as best as I can qualify from a 10-year-old laptop perspective). The basic specs:

Processor AMD A6-3420M Quad-core 1.50 GHz
Memory 4GB DDR3-1066/PC3-8500
Hard Drive 320 GB SATA 5400rpm
Optical Disk DVD-RAM/±R/±RW-Writer
Screen 15.6″ 1366 x 768 Glossy LED
Graphic Card Dual-Graphic -/AMD Radeon HD 7670M

All this for $550 dollars from TigerDirect. The closest comparable model was from HP for $750. I was really recommended to change the RAM speed so this was the first thing I did. Along with the laptop I bought a two stick pack of PC106-1333 8GB memory from PNY for $41 dollars only to have it be non-compatible (or I guess it could have been busted [but passed memory test]). After that I got it from crucial because of their Guaranteed-compatible promise and the speedup is noticeable.

I admit that I got the 5560G because of the graphic card to be able to play games, it was extremely appealing to me. The Notebookcheck tests on it seemed to me to be real good for a mobile graphic card. I was able to get into Dungeon and Dragons Online and the playability was good with the auto-detected medium-high graphic settings. Been thinking about SWTOR, hmm.

I’ll probably one day get a Solid state Drive down the road for it, the 5400 hard drive speed is definitely hard to miss at times. The one from crucial sounds pretty appealing, at $170 dollars though ughh, and I’m not sure I can live with 125GB.

The screen is nice and bright and seems to have good color replication though it does have a limited-gamut and viewing angle (a typical 1366 x 768 these days I’m told). It uses an LED which is nice; glossy, not so. Having it be so reflective worried me at first I was real surprised though when I turned it on how it made that shiny virtually indistinguishable.

Keyboard and touchpad feel good. The keyboard is full-size and key pushes offer an easy, uniform resistance. I really like the touchpad. The surface provides a nice bit of friction for feedback and the size fits really well. Wish manufacturers would get away from touchpad tapping on as default however (be nice if even there was a hardware way to turn it off).

The look and balance is nice as well (if you can’t tell the look from the photos). Doesn’t weigh too much and doesn’t feel off-kilter like other laptops I’ve experienced. The hinge is sturdy and pivots nicely.

Pluses and Minuses

  • + Price
  • + Graphic Card
  • – 5400rpm Hard Drive
  • – RAM Speed
  • – USB 2.0
  • ? USB port in front of DVD-writer


Site note first: I can’t believe I am saying it but I like Windows7. It’s well put together and has good help. Out of the box everything worked pretty well. What can I say though, I like hacking; plus I love open-source.

I’m not sure how I got so lucky buying this but after installing Linux everything just worked.