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

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.

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.

Arachnophilia: a Beautiful, Basic, Web Editor

Screenshot from 2014-02-13 06:31:55Update (2014-02-14): Since this post I’ve moved onto Bluefish because it has better support of tables. Bluefish has the ability for pre-defined tags with snippets ability… nice.

I’d just about tossed in the towel on finding an HTML editor that I felt comfortable with when I happened upon this: Arachnophilia; and now I not sure how I could be better off.

Arachnophilia isn’t technically a Linux program, rather it’s a Java program. I’ve avoided using Java programs until now because they ran slowly; however, Java seems to have come a long way from the earlier days and Arachnophilia runs decent, decent enough for me to use on a regular basis.

Arachnophilia is designed to allow direct access to numerous tags. The tags on the two toolbars include the most popular tags and more can be easily added. The library on the left lists a good number more tags. Just about everything is editable in Arachnophilia including the menus. The huge bonus too is that Arachnophilia allows creation of new user-created tags. With this program I’ve been able to create custom tags that I use with my blog.

There is no installing Arachnophilia, just downloading the Arachnophilia Java archive and then directing Java to start it (or if on a Debian system can use the .deb below):

java -jar Arachnophilia.jar

Arachnophilia is simple, plain and enjoyable to use and has easily become my default HTML editor. Thank you Paul Lutus for your work.