Category Archives: Linux
I decided to get the LS IPS224V-PN and here is a look at it. First thing I noticed was that the stand was a bit… rickety, probably from the thin neck. This does get noticed especially with the desktop I own, tetters. The second thing I noticed was how even the picture was: good, crisp, even, vibrant. The other thing I noticed was the permeating, yellow din that I’m familiar with with LEDs. This last thing can fortunately be adjusted).
|Input||D-Sub, DVI, HDMI|
I’m not sure what ips is but I think it contributes to the nice viewing angle.
Setup was real easy, took no more than a few minutes and monitor calibration was basic.
The color temperature of cool does a good job to neutralize the yellow color the LED; however the custom setting did better with pictures.
Alternate (yellow LED color remains):
Ultimately I choose to use the cool temperature.
The power button is a large half-circle with an refracting light to indicate power-saving. However, it is extremely bright. There is an option to turn it off when the power is off, but it will still be seen in standby-mode; I’ve had to cover mine up.
I got this display for reading and it is good for that. Text looks very nice. But it also is good with pictures at least as far as my semi-professional eye is concerned. The 14ms (WTG?) response time is a bit on the high end. Videos do show a bit of “ghosting” but it doesn’t bother me that bad.
When I’m about to edit a configuration file or a bash script, sometimes I don’t know if the edit will work. In these cases I create a backup of it in numbered order (to keep track of them if I need to revert the changes). Because this is something I regularly do, I decided to build a script to make this easy. The usage is basic: define the file and destination-directory:
# bckfile definedfile.bash . ‘/home/johndoe/.local/bin/definedfile.bash’ -> ‘/home/johndoe/.local/bin/definedfile_00.bash’
Optionally a tag can be added too:
bckfile youdle .vault/ new ‘/home/johndoe/.local/bin/youdle’ -> ‘/home/johndoe/.local/bin/youdle_02-new’
A limitation of the script is that filename cannot have ‘periods’ in their filename. A heuristics of discovering multiple extensions and with . in the filename itself would be tough.
I am really lazy with my editors. I have aliases in my shell configuration for gedit and vim that are very basic:
alias v="vim -p" # open in tab alias sv="sudo vim -p" alias g="bgcmd gedit" alias sg="bgcmd gksudo gedit"
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 at the time I don’t know how to name or place the file properly. Another reason is that at other times I like to have a scratchpad but would lose information if it was just a New File and a crash… happened.
gt will create and open a file named of the current time (MMDDhhmm) and will be saved in the trash folder. If
gt is followed by a name (e.g.
gt cssbox or
cssbox.css) the name will be appended to the current time.
The name is helpful if wanting to dig the file out of the trash folder at a later time.
Because it was the authors first effort to write a man page, talk was that it was good to use Pod2Man. Pod2man is an application that converts text using Plain Old Document (POD) formatting to traditional manual (man) pages. POD markup is easy to do and
pod2man is conveniently pre-installed on most Linux distributions (as it is part of the Perl package).
To get a good idea of what to do, here is a basic example demonstrating the formatting (of a fictitious program
=encoding UTF8 =head1 NAME dr-smile - output platitudes to help to improve one's mood =head1 SYNOPSIS dr-smile [B<--happy>] [B<--joke>=F<type>] =head1 DESCRIPTION B<dr-smile> outputs jokes and happy thoughts designed to make one fell F<--better>. It has the ability to output pleasant thoughts, jokes, good memories, optimistic fortunes... B<dr-smile> I<isn't> a replacement for a professional doctor, please use responsibly and enjoy. 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)>. =back
There is both text formatting and section formatting that is required for a man page.
All the POD text formatting tags needed to know are as follows:
Man pages use two types of formatting (that I’ve ever seen). That are implemented by POD’s bold formatting and PODS filename-or-italic formatting:
|Formatting type||Used for|
|POD Bold formatting||
|POD Filename formatting
POD Italic formatting
There are three section tags that are used in
pod2man (that I know of). The
pod2man manual refers to these as Command Paragraphs and they are: header/category sections, item sub-sections, and “over” sub-sub-sections for additional descriptions of item sections. References to all of these are in the above example.
- Header/Category sections are the block descriptors and their contents (like NAME, and DESCRIPTION…).
- Item sections refer to options generally and often override
=oversections for their list item.
- Over sections refer to option descriptions.
General layout structure
Man pages follow a basic (though liberal) structure can be well represented by this:
NAME The name of the command, followed by a one-line description of what it does. SYNOPSIS A representative invocation of how to run the command and options it has. DESCRIPTION A detailed description of the functioning of the command. OPTIONS A list of it's options (these are sometimes put in DESCRIPTION). EXAMPLES Some examples of common usage. BUGS List known bugs. SEE ALSO A list of referenced or related commands. AUTHOR Specifying the contact information. COPYRIGHT Specifying the copyright information.
The order of categories varies a bit from man page to man page. The first four categories are almost always the same, however the remaining vary a bit. The above layout is an mnemonic aggregate of category order of the man pages that the author has seen.
Convert pod format to manual page
Pod2man usage is basic:
pod2man dr-smile.pod > dr-smile.1
However, these additional options will probably be wanted to be added, plus compression:
pod2man --section=1 --center="dr-smile manual" --name="dr-smile" --release="1.0" dr-smile.pod | gzip > dr-smile.1.gz
xuserrun is a bash script to run a command on the active X.org server display. This is primarily necessary if from within another environment (different user, console, cron, boot script…). xuserrun gathers DISPLAY and user environmental variables via systemd and passes them on to be able to dothis. xuserrun is designed for use with only a single user X.org server display. Running it is basic:
xuserrun xclock -digital
Tto put out a notification:
xuserrun notify-send "Hello, Dave."
When I first used
ln, I expected the behavior of
ln source link to work. But
ln is slightly more complicated than that. While learning it from the beginning, I discovered it does not always resolve the path correctly; additionally, it doesn’t not error if the source is non-existence. I discovered that this was necessary because
ln is designed to be versatile. So I understood that one would want links at times to be created that don’t exist yet, but it was unhelpful to me in the way that I felt
ln should logically work, and the way that I wanted to use it.
Originally, I would do a link like this and it would be broken:
# ln -s ../dir/file dir/
I’ve attempted other links since then that too (of which I can’t remember now) would also be broken. So the way I discovered to do links correctly without doubt was to use whats called the fully-qualified or absolute path (i.e. a path defined from root [
# ln -s /home/username/Document/file /home/username/Desktop/file
There’s a program called
realpath that does this, so I wrote a wrapper script for it and it turned out to be pretty easy. The script resolves the absolute paths, verifies the existence of the source directory and link parent directory, and detects write permissions prompting sudo when needed. It works like this:
# lnk ~/Documents/Resumes/ ~/Desktop ‘/home/username/Documents/Resumes’ -> ‘/home/username/Desktop/Resumes’
# lnk ~/Documents/Resumes/ ~/Desktop/Resumes-I-like ‘/home/username/Documents/Resumes’ -> ‘/home/username/Desktop/Resumes-I-like’
a specifically named link will be put on the Desktop.
# lnk /etc/fstab ~ # or use ~/fstab-edit ‘/etc/fstab’ -> ‘/home/todd/fstab’
If trying to link to a write-protected directory:
# lnk /usr/share/vim/vim73/vimrc_example.vim /etc/vimrc [sudo] password for $USER: ‘/usr/share/vim/vim73/vimrc_example.vim’ -> ‘/etc/vimrc’
An error message will appear if the source or link parent directory doesn’t exist:
* The script will work for just about any instance with the exception of removable media where relative-paths would be better used.
I wanted to convert an mp3 file to an mp4 or avi file because I wanted to be able to use it on my PS3 ( the PS3 has a basic audio player that doesn’t save position [ particularly troubling for large audiobooks ] ). This although is good for audio posting on youtube… I found a script by Jeremy Tharp that needed a bit of a tuneup (quoting parameters for file names with spaces, fixed exit status, better detection for the duration) and it works pretty good:
I use my laptop primarly at home with an external monitor as discrete, meaning that I have the laptop monitor turned off and I only use it. At times this is also called a dedicated monitor. GNOME can be set to disable the laptop monitor and enable the external but it wasn’t able to hotplug the monitor after I returned the laptop, and at times wouldn’t do so after resuming from sleep. Also in the proccess I discovered that the X.org server DPI setting wasn’t being done correctly and that GNOME’s text scaling needed to be adjusted. So I decided to do it in a script and it turned out to be pretty easy.
I wrote the basic script that toggles monitors depending if the external monitor is present, then it detects correct physical size dimension of the screen so the the correct DPI can be set. After this, I added a startup script (.desktop file), a pm-utils script to runafter resuming, and a udev script to detect andset the monitor when plugged in. The udev rule is generic but appears to be working for a lot of people, it relys on Kernel Mode setting (KMS) so doesn’t work for me wiht the catalyst driver, but every thing else works great. I put it on github for any who like to look at it.
The bash script cannot be used right away instead a couple bit will need to be directed:
The package cannot be installed directly and be expected to work, some edits will need to be made. First, in the resume script '80_discretemon' a username will need to be defined; next, the monitor names will need to be defined as created by the driver in 'discretemon'.
Also, the monitors can be defined in
xorg.conf but the fix for after resume from sleep, remains.
Section "Monitor" Identifier "0-LVDS" Option "VendorName" "ATI Proprietary Driver" Option "ModelName" "Acer Aspire Laptop Screen" Option "DPMS" "true" Option "TargetRefresh" "60" Option "Position" "0 0" Option "Rotate" "normal" Option "Disable" "true" DisplaySize 344 194 # only works with xrandr disabled. EndSection Section "Monitor" Identifier "0-DFP1" Option "VendorName" "ATI Proprietary Driver" Option "ModelName" "Samsung SyncMaster SA350" Option "DPMS" "true" Option "PreferredMode" "1920x1080" Option "TargetRefresh" "60" Option "Position" "0 0" Option "Rotate" "normal" Option "Disable" "false" DisplaySize 476 268 # only works with xrandr disabled. Option "DPI" "102 x 102" EndSection
When I discovered MarkDown I was in love, it was very nice to discover an easy, clean, well-thought-out markup language. I wanted a way to be able take my detailed notes, have them easy to read, and then to be able post them here on the blog that would be in a nice WordPress format. Yesterday, I wrote about discovering
pandoc which enables a person to write in markdown and have it converted to HTML. To be able to use the HTML code created by
pandoc in WordPress it needed to be slightly edited and cleaned up. Therefore,… I created a bash script for it.
It works pretty good. Basically it removes tags for paragraphs (
<p>), cleans up code blocks, improves formating, as well as doing a few other things. I haven’t gone through all permutations that pandoc conversion can do so a few thing swill be left out, but otherwise it should work for most things. If anything needs to be added please let me know.
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…“.
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.
Pandoc has extended markdown to use code blocks
```, tables, and a few other things and converting is very basic:
pandoc file.md -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.
I asked at Stack Overflow recently if I could embed a text file into a webpage. My reason was basic: I wanted to be able to use my newly created GitHub script repository to be my source for scripts I posted on this blog. If I was able to do this, I reasoned, than my script on the blog will be up-to-date when I updated my GitHub repository. Unfortunately, there appears to be no direct way to do this that I could find so I look for an alternative and found GitHub Gist. GitHub Gist’s description:
Gist is a simple way to share snippets and pastes with others. All gists are git repositories, so they are automatically versioned, forkable and usable as a git repository.
I was hoping that there would be a way to link a script but there isn’t. Basically the standard process it to visit the GitHub Gist WebUI paste the script, config, … and then post the link on its own line into WordPress.
Because this creates git repository it means it can be updated. So I wrote a script does two functions: 1) Creates a repository for a file; 2) updates all files listed in the script with a Gist repository.
Works pretty good, there are a couple caveats though. First, Gist does not recognize the interpreter on the first line of a script and instead uses the extension. I tend not to use the
.sh extension but I wanted syntax highlighting so the script on the blog now are labeled as
name.sh which I guess isn’t a huge deal. Second, each script must have it’s own repository or all the scripts, configs… would be placed when put into a post. Not sure if this a breach of etiquette but I think I’m ok.
The script requires defunkts excellent
gist command line upload tool.
The syntax is such:
ghsync-gist - Add or update gist repo(s) a - Add gist repo for file(s) u - Update all gist repos for all files