Gentoo Linux Tidbits

Todd Partridge (Gently):

Updated bash script and generally

Originally posted on Linux Tidbits:

I’ve been using Gentoo for about two years now and I took notes on managing my box. These are those notes. If you’re interested in installing Gentoo take a look at Gentoo Quick Install.

Update: bash script

This section is an addition. I’ve since created a bash script that does many of the functions and make reading the rest less necessary. The script is self-explanatory: link.

About Portage

Gentoo Linux uses a package management system called Portage. Portage offers one of the most extensible and customizable package systems available in Linux.

System Update

Update all packages on the computer. This process involves: syncing Portage, creating a text file to review updates, updating the system, merging new configuration files, remove orphaned dependencies.

Sync the portage tree

emerge --sync # or
eix-sync      # preferrable for faster searches (eix search)

Examine update before install

emerge --pretend --verbose --update --newuse --deep @world…

View original 806 more words

Vim colorscheme tuneup

I hadn’t thought about it for awhile but today I updated by Vim colorscheme for the first time in about two years. In the process I found a few that were notable:

rdark-terminal

vcs_1_rdark-terminal

link

gruvbox

vimcs_2_gruvbox

link

synic

vcs_4_synic

I think this one is based on neon. link

kolor

vcs_5_kolor

link

jellybeans blueberry

vcs_7_jellybean-blueberry

This is what I decided on. It’s jellybeans with a twist. I put this in my ~/.vimrc for the adjustments:

colorscheme jellybeans
" Jellybeans colorscheme edits (not working)
"let g:jellybeans_overrides = {
"\   'Normal': { 'ctermbg': '242' }, 
"\   'CursorLine': { 'ctermbg': '238' },
"\}
highlight Normal     ctermbg=323232
highlight Normal     ctermbg=303030
highlight CursorLine ctermbg=238
highlight Visual     ctermbg=240

Others may have different results though as the theme alters dynamically as per background (mine is #323232 btw).

Download

I got these from a collection today and have put them in the AUR

arpa: (Ar)ch (pa)ckages – generic package tasks wrapper script

Todd Partridge (Gently):

Arch wrapper for pacman updated, very well tuned now.

Originally posted on Linux Tidbits:

I once saw a wrapper-script for pacman in the forums that was basically a short-hand version of common pacman tasks. Over the last couple years, I’ve expanded on it. It does just about everything I need it to and its real basic. I call it arpa and here are the tasks it covers:

arpa [option] [*package] - generic package tasks wrapper script -e, --explicit - install a package as explicit -g, --get - only download package files : -G for upgrade files -i, --install - install a package : -I for deps, *.pkg.tar.* -l, --list - list files installed by a package : -L genlist inst. pkgs -n, --info - information about a package -o, --owns - owning package of a file -q, --query - query for an installed package : -Q adds description -r, --remove - remove a pkg and its deps : -R force, no param orphs -s…

View original 43 more words

bashrc

Todd Partridge (Gently):

Updated today, gotten better… redone.

Originally posted on Linux Tidbits:

The ~/.bashrc is a the bash shells’ setting file. The ~/.bashrc can also be used to specify other bash shell related items like abbreviating commands and creating shortcuts. Here is my ~/.bashrc , all bells, no whistles.

View original

Get down with getopt

What is getopt?

getopt is a command used in scripts to parse their options and add a basic error checking ability. getopt is not getopts the bash built-in that has similiar functionality. Urban Vagabond explains:

getopt and getopts are different beasts, and people seem to have a bit of misunderstanding of what they do. getopts is a built-in command to bash [that] processes command-line options in a loop and assigns each found option and value in turn to built-in variables [(so that they can be further processed)]. getopt, however, is an external utility program, and it doesn’t actually process your options for you the way that [(e.g.)] bash getopts, the Perl Getopt module, or the Python optparse/argparse modules do. All that getopt does is canonicalize the options that are passed in — (i.e. convert them to a more standard form) so that it’s easier for a shell script to process them.

For example, a use of getopt converts the following:

tmpscript -abd -ooutfile.txt

into this:

tmpscript -a -b -d -o outfile.txt

getopt can also process the long format option of --output=/tmp.... Also basic error check abilities, it has:

tmpscript -c
tmpscript: invalid option -- 'c'

or

tmpscript -o
tmpscript: option requires and argument -- 'o'

getopt gets defined by telling it the available options in short and long form (if you like). An option with a colon (:) following denotes that an argument is required for that option. If followed by two colons the argument is optional. Here is an example:

Options are generally set as variables so that they can defined how to be used after the while loop (usually, so that mainly they are processed in the right order). getopt parses in the same order as specified on the input, so a -a -d -b input would not work real well if the -d option required the -b option to run correctly.

One caveat of getopt is that each option allows either one or no arguments to follow. So in input like tmpscript -v --files file1.txt file2.txt file3.txt just isn’t possible in any type of predictable-fashion. One can however use quotes on the input:

tmpscript -v --files "file1.txt file2.txt"

or use mutiple options (-f file1.txt -f file2.txt) and append them to an array, as seen, here.

Lg monitor ips224v-pn, look

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).

Details Value
Contrast ratio 5,000,000:1
Resolution 1920×1080
Response time 14ms
Input D-Sub, DVI, HDMI
Output Headphone
IPS Yes

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.

Setting Default New
Brightness 100
Contrast 50 71
Color Temp Custom Cool

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):

Setting Default Alt.
Brightness 100
Contrast 50 67
Color Temp Custom
Red 50 46
Green 50 46
Blue 50 59

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.

Numbered file backups – Easy as can beasy

file-twoWhen 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.

Follow

Get every new post delivered to your Inbox.

Join 52 other followers