Join us on freenode.net channel #utah, the IRC channel for all LUGs in Utah. View channel stats.
findlay
Bandwagon Hopping
I'm not sure what a bandwagon is or why jumping onto one is a pastime
indicative of populist persuasion, but I'll jump on up and grab a trumpet.
$ history|awk ‘{a[$2]++ } END{for(i in a){print a[i] ” ” i}}’|sort -rn|head bash: syntax error near unexpected token `('
Interesting. Being able to instigate cognition on a machine like mine that consists of millions of transistors all vibrating in unison so fast that a pet dog's pet dog couldn't even begin to hear their rhythmical communication running tens of millions of lines of computer incantation (those in the know call it 'code') produces a wonderful sense of technological prowess, meaning that I have no idea what just happened.
It must be a metaphorical premonition of near windfall or danger, I can't tell, but my best guess is that it's telling me strawberries will be on sale the next time I go get groceries. I like strawberries. Or perhaps my trumpet riffs don't accord with the prevailing mode of the bandwagon tune (likely), and I'll break a string on my viola the next time I get it out. That wouldn't actually be too bad, since I've been wanting to get a new set of strings.
$ history|awk ‘{a[$2]++ } END{for(i in a){print a[i] ” ” i}}’|sort -rn|head bash: syntax error near unexpected token `('
Interesting. Being able to instigate cognition on a machine like mine that consists of millions of transistors all vibrating in unison so fast that a pet dog's pet dog couldn't even begin to hear their rhythmical communication running tens of millions of lines of computer incantation (those in the know call it 'code') produces a wonderful sense of technological prowess, meaning that I have no idea what just happened.
It must be a metaphorical premonition of near windfall or danger, I can't tell, but my best guess is that it's telling me strawberries will be on sale the next time I go get groceries. I like strawberries. Or perhaps my trumpet riffs don't accord with the prevailing mode of the bandwagon tune (likely), and I'll break a string on my viola the next time I get it out. That wouldn't actually be too bad, since I've been wanting to get a new set of strings.
Command Shell History Hacks
I was once annoyed with how small the default bash shell history was and how
small the available history was, back when I didn't know they were two
different concepts in bash-think. I now know much better. In fact, I know so
well that I flatter myself you will gratefully appreciate the following clever
mods to bash history behavior.
First, I decided that I wanted the shell to remember every command I entered for about the past 5 years. Your limit may be higher or lower depending on your bash needs.
export HISTFILESIZE=65536
When I originally set this up I wondered how much effect having all 65536 lines of history would bog down each shell process, so I set the following global to a fraction of HISTFILESIZE and never researched the issue further. My ~/.bash_history file is currently 42025 commands long and has existed across distros, partitions, and originated on a previous hard drive in about Summer 2004.
export HISTSIZE=4096
What happens if I want to access a command that's older than 4096? This is where things start to get interesting. About the first hundred times I would begin a command that went something like this:
$ egrep "^command.*arg" ~/.bash_history | sort | uniq
Sometimes I may even know that the command itself had passed beyond the current shell's 4096 memory but the search command hasn't in which case I search for the search command (with C-r). The nested complexity this produced was sufficient to sustain my ego for some time, but ultimately I decided it could be much more elegantly done.
#!/bin/bash grep --color=yes "$@" ~/.bash_history | sort -u
I call this small script search-old-cmd and put it in my ~/.bin directory. Make sure you put it somewhere that's in your PATH and chmod +x it. Now you'll never have to let your shell commands get recycled into the bit bucket since you have a deceptively powerful means of searching out all the excellent one liners you banged out early in the morning to get the job done.
Here's my ~/.bashrc in it's full occult glory. Most of it I pirated from the /etc/bash/bashrc that ships with gentoo, but you will see my HIST settings near the bottom.
if [[ $- != *i* ] ; then return fi shopt -s checkwinsize shopt -s histappend case ${TERM} in xterm*|rxvt*|Eterm|aterm|kterm|gnome*) PROMPT_COMMAND=‘echo -ne “\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007”’ ;; screen) PROMPT_COMMAND=‘echo -ne “\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\”’ ;; esac use_color=false safe_term=${TERM//[^[:alnum:]/?} match_lhs=”” [[ -f ~/.dir_colors ] && match_lhs=”${match_lhs}$(<~/.dir_colors)” [[ -f /etc/DIR_COLORS ] && match_lhs=”${match_lhs}$(</etc/DIR_COLORS)" [[ -z ${match_lhs} ] \ && match_lhs=$(dircolors --print-database) [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ] && use_color=true if ${use_color} ; then if [[ -f ~/.dir_colors ] ; then eval $(dircolors -b ~/.dir_colors) elif [[ -f /etc/DIR_COLORS ] ; then eval $(dircolors -b /etc/DIR_COLORS) fi if [[ ${EUID} == 0 ] ; then PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' else PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' fi alias ls='ls --color=auto' alias grep='grep --colour=auto' alias less='less -R' alias tree='tree -C' else if [[ ${EUID} == 0 ] ; then PS1='\u@\h \W \$ ' else PS1='\u@\h \w \$ ' fi fi unset use_color safe_term match_lhs alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' alias cgrep="grep --color=yes" alias xterm="xterm -geometry 100x40" alias gnome-terminal="gnome-terminal --geometry 100x40 --hide-menubar" export EDITOR="vim" export HISTFILESIZE=65536 export HISTSIZE=4096 if [[ -f ~/.bash_local ] ; then source ~/.bash_local fi
First, I decided that I wanted the shell to remember every command I entered for about the past 5 years. Your limit may be higher or lower depending on your bash needs.
export HISTFILESIZE=65536
When I originally set this up I wondered how much effect having all 65536 lines of history would bog down each shell process, so I set the following global to a fraction of HISTFILESIZE and never researched the issue further. My ~/.bash_history file is currently 42025 commands long and has existed across distros, partitions, and originated on a previous hard drive in about Summer 2004.
export HISTSIZE=4096
What happens if I want to access a command that's older than 4096? This is where things start to get interesting. About the first hundred times I would begin a command that went something like this:
$ egrep "^command.*arg" ~/.bash_history | sort | uniq
Sometimes I may even know that the command itself had passed beyond the current shell's 4096 memory but the search command hasn't in which case I search for the search command (with C-r). The nested complexity this produced was sufficient to sustain my ego for some time, but ultimately I decided it could be much more elegantly done.
#!/bin/bash grep --color=yes "$@" ~/.bash_history | sort -u
I call this small script search-old-cmd and put it in my ~/.bin directory. Make sure you put it somewhere that's in your PATH and chmod +x it. Now you'll never have to let your shell commands get recycled into the bit bucket since you have a deceptively powerful means of searching out all the excellent one liners you banged out early in the morning to get the job done.
Here's my ~/.bashrc in it's full occult glory. Most of it I pirated from the /etc/bash/bashrc that ships with gentoo, but you will see my HIST settings near the bottom.
if [[ $- != *i* ] ; then return fi shopt -s checkwinsize shopt -s histappend case ${TERM} in xterm*|rxvt*|Eterm|aterm|kterm|gnome*) PROMPT_COMMAND=‘echo -ne “\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007”’ ;; screen) PROMPT_COMMAND=‘echo -ne “\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\”’ ;; esac use_color=false safe_term=${TERM//[^[:alnum:]/?} match_lhs=”” [[ -f ~/.dir_colors ] && match_lhs=”${match_lhs}$(<~/.dir_colors)” [[ -f /etc/DIR_COLORS ] && match_lhs=”${match_lhs}$(</etc/DIR_COLORS)" [[ -z ${match_lhs} ] \ && match_lhs=$(dircolors --print-database) [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ] && use_color=true if ${use_color} ; then if [[ -f ~/.dir_colors ] ; then eval $(dircolors -b ~/.dir_colors) elif [[ -f /etc/DIR_COLORS ] ; then eval $(dircolors -b /etc/DIR_COLORS) fi if [[ ${EUID} == 0 ] ; then PS1='\[\033[01;31m\]\h\[\033[01;34m\] \W \$\[\033[00m\] ' else PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' fi alias ls='ls --color=auto' alias grep='grep --colour=auto' alias less='less -R' alias tree='tree -C' else if [[ ${EUID} == 0 ] ; then PS1='\u@\h \W \$ ' else PS1='\u@\h \w \$ ' fi fi unset use_color safe_term match_lhs alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' alias cgrep="grep --color=yes" alias xterm="xterm -geometry 100x40" alias gnome-terminal="gnome-terminal --geometry 100x40 --hide-menubar" export EDITOR="vim" export HISTFILESIZE=65536 export HISTSIZE=4096 if [[ -f ~/.bash_local ] ; then source ~/.bash_local fi
Enchanted
Good friends, forgive me this early morning for waxing somewhat
autobiographical and permit me to divulge a necessary truism governing the
impolitic investiture of this sardonic cynic, and that is fantastic. More
specifically I propose that this cynic is truly romantic. I am predisposed to
enjoy girly literature.
I even have a strong predilection for movies of the girl category. My most
recent committal of such a grievance against my sex, my nerdy geek
demographic, and my carefully cultivated sense for counterintuitive scientific
empiricism comprises a single act of dollar movie indulgence. My roommate and
I just got back from watching Enchanted, and what a delectable
enjoyment it was.
There's no joy in cynicism--no joy in coldly or eloquently mocking a world that cruelly deprives you of your manifest destiny. We are not creatures made to rue over such trite things. The opening sequence of this movie was supersaturated with mono and disaccharides. The effect thereof was a surreal cartoon experience. Yet I can only think it is a fool who will dismiss that world when it intrudes upon their own moody realism. I fear the only effect my life may produce will be rather silly, but that the hope for Mrs Happily Ever After may sustain me until the day that I will finally claim her. There is no achievement so impartially rational that may yield worldly glory comparable to that felicity--no, this saturnine cynic is truly a credulous romantic.
There's no joy in cynicism--no joy in coldly or eloquently mocking a world that cruelly deprives you of your manifest destiny. We are not creatures made to rue over such trite things. The opening sequence of this movie was supersaturated with mono and disaccharides. The effect thereof was a surreal cartoon experience. Yet I can only think it is a fool who will dismiss that world when it intrudes upon their own moody realism. I fear the only effect my life may produce will be rather silly, but that the hope for Mrs Happily Ever After may sustain me until the day that I will finally claim her. There is no achievement so impartially rational that may yield worldly glory comparable to that felicity--no, this saturnine cynic is truly a credulous romantic.
Planetary Wallpapers
Today I had a slight inclination to change my desktop background. I remember
that on Fedora releases they had a bundled desktop wallpaper of an Earthrise
from moon orbit. I don't know if they still have it, but a few months ago I
went looking for a hires pic online but didn't do much with it. Today I went
looking again and found a few of
them.
While searching for the first Earthrise shots from the Apollo 8 mission I found this beautiful photograph of Jupiter on slashdot. There are lots of beautiful celestial photographs, certainly, but let's just use these few as a start for some serious DIY background artwork.
One aspect (literally) you may notice about these images is that they aren't the same dimensions as your computer monitor (unless you have an unusual display). Another property you may observe is that same property that will allow us to easily splice in pixels, spanning them out to a ratio that perfectly matches the display: they all have an excellently achromatic black background. The Apollo Earthrise photos are square and probably came from a square camera by looking at the other photos from the Apollo 8 mission. The Jupiter photo only just frames the glorious sunlit limb in exquisite black, which may suggest that it has been cropped. That won't matter, but we're going to be adjusting the images at their full resolution.
I assume you have a Linux system handy, if not, you can drop in a livecd and reboot. Next make sure you have imagemagick installed. I researched how to perform the following image transformations in the imagemagick documentation.
Let's start with the first monochrome Apollo 8 Earthrise.
$ wget http://history.nasa.gov/ap08fj/photos/e/as08-13-2329.jpg
My screen's resolution is 1920x1440 (a 4:3 aspect ratio, see wikipedia for other common ratios). First observe the original image dimensions.
$ identify as08-13-2329.jpg as08-13-2329.jpg JPEG 2411x2448 2411x2448+0+0 DirectClass 8-bit 645.145kb
Since the moon is nearby in the right part of the image we will insert pixels to the left side effectively panning out a little more to match the proportions of a computer display-shaped viewport of the scene, and since the ubiquitous night circumnavigates the two celestial spheres ad infinitum we'll only need to add columns of pixels to one dimension. Thus, our final image size will become 3264x2448, which is a perfect 4:3 ratio.
$ convert as08-13-2329.jpg -background black -gravity east -extent 3264x2448 apollo_8_earthrise.monochrome.png
And the result is stunning; excellent. Let's try some of the others.
$ wget http://history.nasa.gov/ap08fj/photos/b/as08-14-2383.jpg $ wget http://history.nasa.gov/ap08fj/photos/b/as08-14-2384.jpg $ wget http://dayton.hq.nasa.gov/IMAGES/LARGE/GPN-2001-000009.jpg $ convert as08-14-2383.jpg -background black -gravity east -extent 3200x2400 apollo_8_earthrise.color.1.png $ convert as08-14-2384.jpg -background black -gravity east -extent 3276X2457 apollo_8_earthrise.color.2.png $ convert GPN-2001-000009.jpg -background black -gravity east -extent 4000x3000 apollo_8_earthrise.color.3.png
The Jupiter image was a little more tricky. I decided to split 3/4 of the pixel columns onto the right side to closely center the half illuminated Jovian planet.
$ wget http://oursun.open.ac.uk/images/jupiterp_cassini_full.jpg $ convert jupiterp_cassini_full.jpg -background black -gravity east -splice 960x0 jupiter_cassini.tmp.png $ convert jupiter_cassini.tmp.png -background black -splice 320x0 jupiter_cassini.png && rm jupiter_cassini.tmp.png
Now try out your spiffy new planetary wallpapers! Who needs digital blasphemy anymore? The real thing is more beautiful than the imagination. :-)
Unless your desktop does this automatically for you when you add a new wallpaper, like enlightenment, you may want to scale your images down to the exact pixel size of your display to reduce unnecessary memory usage. This is easy. Suppose I wanted to scale the images down to exactly 1400x1050 (SXGA+ 4:3). Documentation is here.
$ convert jupiter_cassini.png -resize 1400x1050 jupiter_cassini.scaled.png
Here's a full list of the images created in this post.
apollo_8_earthrise.color.1.png
apollo_8_earthrise.color.2.png
apollo_8_earthrise.color.3.png
apollo_8_earthrise.monochrome.png
jupiter_cassini.png
jupiter_cassini.scaled.png
While searching for the first Earthrise shots from the Apollo 8 mission I found this beautiful photograph of Jupiter on slashdot. There are lots of beautiful celestial photographs, certainly, but let's just use these few as a start for some serious DIY background artwork.
One aspect (literally) you may notice about these images is that they aren't the same dimensions as your computer monitor (unless you have an unusual display). Another property you may observe is that same property that will allow us to easily splice in pixels, spanning them out to a ratio that perfectly matches the display: they all have an excellently achromatic black background. The Apollo Earthrise photos are square and probably came from a square camera by looking at the other photos from the Apollo 8 mission. The Jupiter photo only just frames the glorious sunlit limb in exquisite black, which may suggest that it has been cropped. That won't matter, but we're going to be adjusting the images at their full resolution.
I assume you have a Linux system handy, if not, you can drop in a livecd and reboot. Next make sure you have imagemagick installed. I researched how to perform the following image transformations in the imagemagick documentation.
Let's start with the first monochrome Apollo 8 Earthrise.
$ wget http://history.nasa.gov/ap08fj/photos/e/as08-13-2329.jpg
My screen's resolution is 1920x1440 (a 4:3 aspect ratio, see wikipedia for other common ratios). First observe the original image dimensions.
$ identify as08-13-2329.jpg as08-13-2329.jpg JPEG 2411x2448 2411x2448+0+0 DirectClass 8-bit 645.145kb
Since the moon is nearby in the right part of the image we will insert pixels to the left side effectively panning out a little more to match the proportions of a computer display-shaped viewport of the scene, and since the ubiquitous night circumnavigates the two celestial spheres ad infinitum we'll only need to add columns of pixels to one dimension. Thus, our final image size will become 3264x2448, which is a perfect 4:3 ratio.
$ convert as08-13-2329.jpg -background black -gravity east -extent 3264x2448 apollo_8_earthrise.monochrome.png
And the result is stunning; excellent. Let's try some of the others.
$ wget http://history.nasa.gov/ap08fj/photos/b/as08-14-2383.jpg $ wget http://history.nasa.gov/ap08fj/photos/b/as08-14-2384.jpg $ wget http://dayton.hq.nasa.gov/IMAGES/LARGE/GPN-2001-000009.jpg $ convert as08-14-2383.jpg -background black -gravity east -extent 3200x2400 apollo_8_earthrise.color.1.png $ convert as08-14-2384.jpg -background black -gravity east -extent 3276X2457 apollo_8_earthrise.color.2.png $ convert GPN-2001-000009.jpg -background black -gravity east -extent 4000x3000 apollo_8_earthrise.color.3.png
The Jupiter image was a little more tricky. I decided to split 3/4 of the pixel columns onto the right side to closely center the half illuminated Jovian planet.
$ wget http://oursun.open.ac.uk/images/jupiterp_cassini_full.jpg $ convert jupiterp_cassini_full.jpg -background black -gravity east -splice 960x0 jupiter_cassini.tmp.png $ convert jupiter_cassini.tmp.png -background black -splice 320x0 jupiter_cassini.png && rm jupiter_cassini.tmp.png
Now try out your spiffy new planetary wallpapers! Who needs digital blasphemy anymore? The real thing is more beautiful than the imagination. :-)
Unless your desktop does this automatically for you when you add a new wallpaper, like enlightenment, you may want to scale your images down to the exact pixel size of your display to reduce unnecessary memory usage. This is easy. Suppose I wanted to scale the images down to exactly 1400x1050 (SXGA+ 4:3). Documentation is here.
$ convert jupiter_cassini.png -resize 1400x1050 jupiter_cassini.scaled.png
Here's a full list of the images created in this post.
apollo_8_earthrise.color.1.png
apollo_8_earthrise.color.2.png
apollo_8_earthrise.color.3.png
apollo_8_earthrise.monochrome.png
jupiter_cassini.png
jupiter_cassini.scaled.png



:: Recent comments :.
1 year 14 weeks ago
1 year 33 weeks ago
2 years 38 weeks ago
2 years 42 weeks ago
3 years 2 weeks ago