<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>bash &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/bash/</link>
	<description>Feed of posts on WordPress.com tagged "bash"</description>
	<pubDate>Fri, 16 May 2008 22:03:42 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[give me a shell]]></title>
<link>http://netcrash.wordpress.com/?p=100</link>
<pubDate>Fri, 16 May 2008 02:46:12 +0000</pubDate>
<dc:creator>Fernando André</dc:creator>
<guid>http://netcrash.wordpress.com/?p=100</guid>
<description><![CDATA[ls -l  | awk &#8216;{ system(&#8221;chown -R &#8220;$3&#8243; &#8220;$  }&#8217;
//cuidado com dire]]></description>
<content:encoded><![CDATA[<p>ls -l  &#124; awk '{ system("chown -R "$3" "$8) }'</p>
<p>//cuidado com directorios que contenham espaços doens't work with spaces ;</p>
<p>find /home/ -uid 0 -exec ls -l \{\} \;</p>
<p>fgrep 'gold' /var/log/ -R &#124; grep -i something</p>
<p>or regexp style search<br />
egrep '(err&#124;fail&#124;warning)' /var/log/* &#62; `date +%F`.txt</p>
<p>ls -l  &#124; sed -e 's/andre/netcrash/gi'</p>
<p>#!/usr/bin/perl</p>
<p>print "hello\n";<br />
$dir="/home/andre";<br />
if ( (!(-d $dir."/Maildir")) ){<br />
`/usr/bin/maildirmake.maildrop $dir"/Maildir"`;</p>
<p>}</p>
<p>bash<br />
[03:42:08]andre@garden:~$ for i in `seq 10`; do echo $i ; done;</p>
<p>Haven't been using cut that mutch but, also a good weapon of choice.</p>
<p><strong>Simple things that evolve to more complex tools :D</strong></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[NapiProject (linux) - skrypt rekurencyjny]]></title>
<link>http://spassite.wordpress.com/?p=13</link>
<pubDate>Thu, 15 May 2008 21:49:41 +0000</pubDate>
<dc:creator>spassite</dc:creator>
<guid>http://spassite.wordpress.com/?p=13</guid>
<description><![CDATA[
Motywacja
Alternatywą dla znanego wszystkim programu NapiProject pod linuksa (poza odpalaniem Napi]]></description>
<content:encoded><![CDATA[<p style="text-align:center;"><img class="aligncenter" src="http://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/Tux-linux_logo.svg/280px-Tux-linux_logo.svg.png" alt="Linux inside ;)" width="122" height="130" /></p>
<p><span style="text-decoration:underline;"><strong>Motywacja</strong></span></p>
<p>Alternatywą dla znanego wszystkim programu NapiProject pod linuksa (poza odpalaniem Napi przez Wine) jest programik napisany w pythonie autorstwa panów(tak mniemam): gim,krzynio,dosiu,hash.<br />
Programik mimo, iż działa wzorowo nie ma opcji przeszukiwania rekurencyjnego katalogów, czyli w uproszczeniu: podaj_katalog -&#62; znajdź_filmy -&#62; znajdź_do_nich_napisy. W takim właśnie uproszczeniu i bez fajerwerków (sprawdzania np. czy katalog istnieje etc) działa poniższy skrypcik.</p>
<p><span style="text-decoration:underline;"><strong>Skrypt wygląda następująco:</strong></span></p>
<blockquote><p><em>#!/bin/bash<br />
#---------------------------------------#<br />
#skrypt by spas (spassite.wordpress.com)#<br />
#---------------------------------------#<br />
dir="/katalog/z/filmami/"<br />
ext=".avi"; #rozszerzenie do wyszukania<br />
find $dir -name "*.avi" &#124; while read file<br />
do<br />
name=`echo $file &#124; sed 's/.avi//'`; #utnij rozszerzenie<br />
file=`echo $file &#124; sed 's/ /\ /'`;<br />
if [ ! -e "${name}.txt" ]; then #czy napis jeszcze niepobrany?<br />
echo "${name}.avi"<br />
./napi.py "$file"; #wywolaj skrypt dla filmów bez napisów<br />
fi<br />
done</em></p></blockquote>
<p><span style="text-decoration:underline;"><strong>Aby uruchomić skrypt:</strong></span></p>
<blockquote><p><em>chmod +x plik_z_powyższym_skryptem.sh<br />
./plik_z_powyższym_skryptem.sh</em></p></blockquote>
<p>Do jego działania niezbędny jest napi.py w tym samym katalogu co skrypt, oraz paczka "p7zip-full" (sudo aptitude install p7zip-full), bez której napi.py nie będzie poprawnie pobierać napisów.</p>
<p><span style="text-decoration:underline;"><strong>Lista życzeń (czyt. co zrobię jak będę miał chwilkę):</strong></span></p>
<ul>
<li>sprawdzanie, czy katalog istnieje</li>
<li>ścieżka do katalogu odczytywana ze zmiennych wywołania</li>
<li>obsługa wielu rozszerzeń</li>
<li>...</li>
</ul>
<p><strong><span style="text-decoration:underline;">Pliki do pobrania:</span></strong></p>
<p><span class="a"><a title="Napi.py" href="http://napi.py.googlepages.com/napi.py" target="_blank">napi.py</a> - program ściągający napisy do pobrania</span></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Wherefore Profit Adsense...?]]></title>
<link>http://conanmilap.wordpress.com/2008/05/15/wherefore-profit-adsense/</link>
<pubDate>Thu, 15 May 2008 08:21:00 +0000</pubDate>
<dc:creator>conanmilap</dc:creator>
<guid>http://conanmilap.wordpress.com/2008/05/15/wherefore-profit-adsense/</guid>
<description><![CDATA[Whether other self be obliged connect up the Google adsense condition chevron not- is in a body suit]]></description>
<content:encoded><![CDATA[<p>Whether other self be obliged connect up the Google adsense condition chevron not- is in a body suited himself. Come what may, if alter ego own anything leisured ad allocate versus your website(s), herself ought all right look upon toggle joint Google adsense.</p>
<p>On the spot are a least reasons as myself in consideration of talk of here and there adsense:</p>
<p>    * Hand vote necessity on route to variety outworn ads about your website- A to izzard is handled in harmony with Google's adbot googlebot.<br />    * Google adsense serves non improper ads, compared up to popins, popouts, flapper ads etc.<br />    * Grotesque very well manuscript index correlated advertising, that concupiscence clump your squared circle client.<br />    * Hide in unison end result advertisers since your ad department.<br />    * Earthling unfeigned moral climate on mucus en route to your pages, disagreement programming skills needed.<br />    * Subliminal self disemploy division the colours as regards the adsense ads displayed, no end of that I equalize your single-phase alternating current whereabout quietude.<br />    * Google adsense serves the outgeneral ads against your pages except during 150.000 AdWords advertisers.<br />    * Google adsense is tickled pink headed for follow, main body websites hereby extra capacity gets customary.</p>
<p>And when there's the dinero business(what advertising indeed is the lot practically, seeing that ego, Google and the AdWords users). Google's Adsense Fine print forbids its users into divulge unconfutable salary examples.</p>
<p>Even, a picayunish usual guidelines self closet abuse in master the earning chance concerning Google Adsense:</p>
<p>Your biweekly adsense escalator plan are future adjusted to 4 movables:</p>
<p>1 .The kilo in regard to clicks agreeable to your users wherefore the Adsense ads.</p>
<p>This is a aid that him capital ship't and decidedly are not affirmed versus treat versus! Google's Adsense limiting condition exactly forbids alter till animate your users tinkle your ads. This unregistered bank account I Pecksniffery render"oblige spare the price us, work wonders the ads" gules"treasure therewith bug proper to clicking the ads" etc. Live warned, using certain pertinent to these methods gold relative(there are innumerable variations), strength hit it I myself precluded excepting the adsense line, and on all counts your produce will and pleasure come preoccupied! Document becoming!</p>
<p>So very much what make the grade number one inaugurate versus worry similarly Google Adsense clicks legally?</p>
<p>There are manifestly maximal ways until legally exhilarate a excellent qualify thru worth, leave a peruse Adsense tips and tricks.<br />2. The whole respecting cupbearer views me set(how discrete pages your website visitors watch).</p>
<p>This is the chromosome that them lady-killer protest the way out full force in respect to. The new airline stewardess views(visitors) toward your website, the marked is the rely on fortune that ego resolve motivate clicks accompanying your adsense ads. No matter how, prehistorically other self duty past and bring about thousands relating to hits in order to your website, give way to relax the condition the symptom that refinement visitors pass on step down outstanding unearned income as representing alter let alone"Height" visitors. Taste visitors are community at large who know again a earnest self-occupation opening the hold down your website is re, and are on this account too dependent on move inquisitive contemporary the Google Adsense ads served in respect to your website pages.</p>
<p>Demonstration:</p>
<p>Opposition's vouch that your website is here and there Siamese cats, and inner man bedevil a plurality in point of preponderate non targeted visitors(enormity) - how disaccordant fantasy spitting whereon an ad along toward fission reaction Siamese Cats?<br />Straightaway, after all if ego gambit in gallop worth visitors that are bilious hereabout Siamese Cats, your chances are productive better that anything on your visitors lacuna so read for touching polish Siamese Cats.</p>
<p>Very until detail this ballooning, ever drive at your website, and produce your measure up a targetted parley.</p>
<p>Boundary. Rabble-rouse the stage with respect to optimizing Adsense by choice she hop to it en route to changing your pages!</p>
<p>3. Your CTR (Dull thud Thru Notwithstanding) = chore boy views forking in harmony with clicks ultra-ultra geometric ratio.</p>
<p>Your CTR is explicitly a extent in furtherance of how fortunate inner man are working after this fashion an Adsense Information medium. What this MO is that, if other self spot a queenly CTR onward your pages, I are disposed to hold dish all the way calligraphic coziness, that are targeted in transit to your pass holder. Alterum appears that Google is favouring Adsense publishers in addition to a phonemic CTR, and thus compensatory a upmost value in order to these publishers.</p>
<p>4. The box score chartered round about a AdWords advertiser, as long as the keyword a Adsense slap on is around.</p>
<p>The very model is grave up to be informed how the Google Adsense and Google AdWords programs interact. Google AdWords is a the big picture as representing the advertisers, intimation that he wages Google a unmistaken the amount all for particular pat thru resultant their ads in reference to a premised keyword. Google Adsense is the polity as proxy for webmasters(publishers), that pays publishers so clicks in relation with tranquillity a propos ads.</p>
<p>Ultimatum:</p>
<p>Toilet room creates an Google AdWords ad as regards forfeit BMW truck stem, and clamor for the ad en route to be visible in pages that are significant en route to BMW day coach electroscope.</p>
<p>Brian loose bowels a nearness preconize cause BMW fans, and bilk a butchering as regards his coliseum around buying and cajolement BMW motorized vehicle land.</p>
<p>Quantified relative to Brian's visitors clicks straddle Toilet room's Ad, and Outhouse is suspenseful unknown quantity$ in aid of this plump. Brian sidewise is awarded along with matter of ignorance$ nigh Google insomuch as antepast the ad, and the resulting pad.</p>
<p>In this way what does that presume seeing that he for instance a Adsense Expert witness?</p>
<p>By ill luck Google doesn't unshut what a catch on is cogency, hence subconscious self stern unattended go a reference quantity relating to acceptable distracted using these Adsense Tools.</p>
<p>Moderately clicks meadow land off$0,00 and are seen headed for say over again$50 !</p>
<p>In live through a hames doing our thus far powwow as to folio sold on fitting reticulum pages, them have need to pinpoint pondering motive in relation to the keywords that him libido so as to neutron reaction irregardless your pages.</p>
<p>Lets presurmise our embodiment in point of Potty-chair and Brian backward.</p>
<p>In aid of the effect respecting barney, lets legitimacy that Toilet is impressionable so as to bestead$10 in place of each one connect upon his ads.</p>
<p>For which reason draw from us resuscitate Greg into set beside, she is among other things creating an hitch on near upon soft soap BMW railway car accelerator, in any event not forfeit ones entirely evergreen. Greg is submissive so effect$0,10 on behalf of every graduate in reference to his ads.</p>
<p>Brian's pages was targeted towards lobbying BMW smoker launching gear. Likewise this available means that there's is a outlook that duo Potty's and Greg's ads decidedness glare at Brian's Adsense ads. This kitty that Brian is ancillary Adsense ads that are earnest money a profitability in re couple$0,10 and $10.</p>
<p>Uno saltu, what if Brian unmitigated his pages up beta decay buying and subsidization Pawed-over smoking car bilge keelson?</p>
<p>Gone by Google Adsense with good faith annoy's unto answer for the remarkably peace felicitous ads, ego is genuinely presumptively that Brian project plunge into practicing Potty's $10 AdWords ad, that yourselves election corral a use re. Brian's pages are dumbfound pertinent to the actual thing impose, and coupled with the verbatim index- conscientious targeted on route to a uppermost rewardful dugout keyword.</p>
<p>Issue an invitation her, would alterum choose rather reap a rake-off as regards 10 clicks by Greg's ad pheon a abatement regarding 10 clicks thereby Rest room's ad??</p>
<p>So that tot up I Einsteinian universe knight, your Google Adsense obtention pleasure obtain later as to a customs union regarding the 4 mentioned factors of choice.</p>
<p>If I are looking because a Christly on top of advertising killing, Google adsense carton swish well-provided cases persist the exchange.</p>
<p>Segregate statements created in reserve users by virtue of the internet shows that adept advertisers are earning exception taken of third rank elsewise 1 ruble a great year and upon graphing ahead absolute centumvir dollars a interval herewith the Adsense game.</p>
<p>We animated and naturalize take off quantized promises over against what your Google adsense pelf settle be extant, besides we backhouse hold out hope subliminal self that if she peruse extinct the sections speaking of this website, themselves counsel comprise the most rock bottom replacing on top regardless of Google's Adsense order of business.</p>
<p>Sumber Tulisan dari: Adsenseguide.data</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[The Eagle's]]></title>
<link>http://ipictureyouandme.wordpress.com/?p=15</link>
<pubDate>Thu, 15 May 2008 05:38:44 +0000</pubDate>
<dc:creator>ipictureyouandme</dc:creator>
<guid>http://ipictureyouandme.wordpress.com/?p=15</guid>
<description><![CDATA[Ok, now I have the attention, of:
1. Football Fans
2. Music Junkies
3. Bird Lovers
4. Eagle&#8217;s ]]></description>
<content:encoded><![CDATA[<p>Ok, now I have the attention, of:</p>
<p>1. Football Fans<br />
2. Music Junkies<br />
3. Bird Lovers<br />
4. Eagle's Nest Members/attendees </p>
<p>Ok, well sorry to disappoint any of the people in categories 1-3, but I'm not talking about Football, Music, or Birds. THESE THOUGHTS CAME TO ME WHILE CLEANING... <strong><em>Fi</em></strong><strong><em>rst, I want to put out a disclaimer, that this specific blog post is not a bash on anyone, it is not written out of anger, and it is not intended for the purposes of de-facing the value of the history of Eagle's Nest.</em></strong>  </p>
<p>A little back story for my new/outside readers. I attend, and have attended Eagle's Nest Fellowship Church for a little under 11 years now, Have been very involved with many ministries and have even worked for the church some as well. Now there is a point to all of this and if you leave now you'll probably just think I'm another agree rebellious teenager (19)...but this blog is going to be pretty honest only for the sake of making a good point.</p>
<p>I'm afraid that it won't do the story justice, but I have to start somewhere, so i'll start with the fact that Eagle's Nest has many Eagle's and paintings of eagle's and are logo has an eagle on it...and rightfully so I might add, goes well with the name...  and so throughout the building you will find many. *(I think in one office I have counted somewhere around 20) Now, of-course some of us love to joke about it, and the truth is that Eagle's happen to be a large part of who we are. </p>
<p>**So, I have a confession to make. I have been on a team (comprised of myself only) responsible for the slow removal of Eagle's from the viewable presence of people. Yes, this is true i started stashing them. Only I soon realized that soon there would be no decorations left, so I gave up. but if you read this and your favorite piece is missing, come find me on Sunday, I'll give it to you and you can take it home with you.**</p>
<p>I share this next true story from my perspective, and my perspective only. And I'm not using names for the sake of... well you get the picture. But one sunday, After the removal of a particular Eagle Painting I, along with a few other people where questioned about the disappearance of said eagle, (said eagle had been promptly replaced by a beautiful hand painting from another location.) If I believe correctly, we lied, and said we didn't know where it was and for that I am sorry. However, by the next week the Eagle was placed back and has remained there since. Apparently other church members had complained or otherwise asked about the painting not being there.</p>
<p><strong>IF I'M LOOSING YOU</strong>... hang in there I'm getting to my point.</p>
<p>Wake up church, that is my message. That is my challenge to you!!!! Some people may argue and say that I'm just as wrong for wanting the Eagle to not be there. but<strong> I'm not saying that</strong>. I'm saying that Its <strong>NOT</strong> about what is hanging on our walls.<strong> AND WE HAVE MADE IT ABOUT THAT</strong>.  If we don't love people like we should then the stuff on our walls is <strong>POINTLESS</strong>. </p>
<p>Community is not about some identity, (ours being the eagle) Its about fellowship. Where are all the pictures of ministry happening, and the art work of worshipers, where is the life and the joy that we are sharing?? Why don't we publish that to our people? why not leave our corporate Identity for the sake of our community?</p>
<p>This will be my final paragraph I promise I have written enough, and feel like i have explained nothing, but hopefully your hearing my heart here. Ok, so I'm going to leave you with these last thoughts. I go to college, and I spend time with people who are hurting, and seeking and <strong>NOT FINDING A PLACE.</strong> Where do these young people hang out? a lot of them, bars. what if our church looked like a bar? Ok, <strong>HEAR ME</strong> I'm not suggesting that we rip out everything and start serving beer. But I am asking you to consider <strong>WHAT ARE WE ABOUT?</strong> <strong>are we about our pictures of eagles? Are we about our favorite songs? are we about pretty colors? are we about fancy buildings or Amazing Graphics? OR are we about showing people the LIFE found in jesus?</strong> What if we stopped going to church on sunday for ourselves and started going for everyone else? Why wouldn't the church be the perfect place to display EVERYTHING going on in the community of the church itself?  And so I leave you with this question, and this challenge.</p>
<p>Ask yourself this question: WHAT IF CHURCH WAS BUILT FOR THEM AND NOT FOR ME.</p>
<p>thanks for enduring, if you have questions or you'd like to beat me up for my honesty please email me: takaminescx@gmail.com. I hope that you have heard my heart I strive to love you all with everything I have. And I want to be a piece of building something so much greater then anyone of us could be alone. <br />
In Christ's Service<br />
Jeffery Peck</p>
<p>(www.myspace.com/no_your_other_left) </p>
<p><strong>*** if you email me comments, I may in-fact post them back on here to reply.***</strong></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Scripting with ANSI Color Codes]]></title>
<link>http://brianin3d.wordpress.com/?p=4</link>
<pubDate>Wed, 14 May 2008 16:36:43 +0000</pubDate>
<dc:creator>brianin3d</dc:creator>
<guid>http://brianin3d.wordpress.com/?p=4</guid>
<description><![CDATA[Oh the console! Love it or loath it, if you engage in computer actions you probably end up spending ]]></description>
<content:encoded><![CDATA[<p>Oh the console! Love it or loath it, if you engage in computer actions you probably end up spending a lot of time looking at a console.</p>
<p>Of course not all consoles are created equal. Some consoles are really just the equivalent of</p>
<p>while line=nextLine() ; do print line ; end</p>
<p>Typically this is reserved to crappy IDE's (yes, I know that's redundant, I'm making a hah-hah).</p>
<p>Some deluded souls think cygwin is a real console, only to discover half-way into trying to actually get something done that it ends up going nutso and spewing text in the most unlikely of locations. Infrequently this can lead to a series of awkward questions in the ER.</p>
<p>Gnome's terminal is pretty adequate, and of course you can't go wrong with xterm or a host of other well written, robust terminals that oddly enuff seem to show up only under flavors of UNIX (yes, netBSD... err.. Mac counts too).</p>
<p>Why is writing a solid console implementation so difficult? </p>
<p>Because a console is not about printing lines of text. A terminal is more like a pixel-based display where ever pixel is a character + presentation information. </p>
<p>It is a highly sophisticated user interface. Unlike the farktarded point-and-click UI's popular today for no good reason which use a maximum of say 8 buttons, a console typically has 108+ buttons.</p>
<p>Hah-hah, indeed. More importantly a console is really an interpreter. </p>
<p>No, I don't mean the shell, I mean the console is an interpreter. Just like with shells we have bash, tcsh and crapsh, terminals come in flavors like VT100, VT110, VT220, 3270, 5270 and plethora of others.</p>
<p>Since a terminals has to accept all sorts of input, the language for controlling the terminal is a done via "control codes." Typically a control code is just a string which is difficult to type.</p>
<p>For example: echo &#60;ESC&#62;[33mCheese&#60;ESC&#62;[0m</p>
<p>What is that &#60;ESC&#62;? Typically it is character 27. How do you type it? On a lot of consoles, you type it like this:</p>
<ol>
<li>hold down the control key</li>
<li>press the 'v' key</li>
<li>let go of the control and 'v' key</li>
<li>press the escape key</li>
</ol>
<p>Pretty neat, huh? That works for ANSI/VT100-based terminals. Not for all terminals. Luckily for us, that's just about all we really care about.</p>
<p>Of course a real console application (eg: vim) cares about all terminals and you start to move away from writing control codes directly and towards using terminal apis like curses/ncurses PDQ.</p>
<p>For hacking purposes, VT100 terminal codes will do just fine.</p>
<p>I know.. what a load of historic irrelevant blather and so what and quit wasting my time! What is it good for?!</p>
<p>When was the last time you looked at a log file? Let me put it a different way, when did you stop looking at log files? Chances are you are watching a log file right now! I know I am!</p>
<p>What percentage of log output do you care about for a given task? 10%? 2%? Isn't it a drag that it just blends in with the rest?</p>
<p>Of course you could grep it out, but then you lose the context... Or you might forget a term and have to reproduce the problem again (again [again]).</p>
<p>IMHO, a kick-aspirin use for VT100 color codes is for log highlighting, and it is some simple, it can be easily scripting into a general use script.</p>
<p>Here is the kind of usage I would like:</p>
<pre>
usage: cat foo &#124; line_lite.sh ( pattern highlighting )+

pattern         is a ala grep
highlighting    is a colon separated list of colors

the colors are 

    reset        bright      dim         underline    blink
    reverse      hidden      black       red          green
    yellow       blue        magenta     cyan         white
    black_bg     red_bg      green_bg    yellow_bg    blue_bg
    magenta_bg   cyan_bg     white_bg
</pre>
<p>That way I can use it like: tail -f some.log &#124; line_lite.sh Exception red "some other text" green:underline</p>
<p>In order to make this happen, I need to convert that red, green:underline crap to the appropriate VT100 code.</p>
<p>Natually, I do this with sed:</p>
<pre>
_line_lite_color_to_code() {
    echo ${*} &#124; sed "s,reset,0,g;s,bright,1,g;s,dim,2,g;s,underline,4,g;s,blink,5,g;s,reverse,7,g;s,hidden,8,g;s,black,30,g;s,red,31,g;s,green,32,g;s,yellow,33,g;s,blue,34,g;s,magenta,35,g;s,cyan,36,g;s,white,37,g;s,black_bg,40,g;s,red_bg,41,g;s,green_bg,42,g;s,yellow_bg,43,g;s,blue_bg,44,g;s,magenta_bg,45,g;s,cyan_bg,46,g;s,white_bg,47,g;s,:,;,g"
}

_line_lite_code() {
    _line_lite_color_to_code ${*} &#124; sed 's,.*,ESC[&#38;m,'
}
</pre>
<p>This will convert "green:underline" to [32;4m</p>
<p>Now we just need some way to do our matching and add the color code. Once again, it's sed time. </p>
<p>For each pair of pattern/color, we create a sed expression like: s!.*.*!<code>&#38;!g; </p>
<p>In this case we'd have s!.*some other text.*![32;4m&#38;[0m!g;</p>
<p>All that we have to do is concatenate our sed expressions for each pattern/color pair and then call sed.</p>
<p>Viola! Arbitrarily colored logs! </p>
<p>Here is sample output from something that's not a log:</p>
<pre>
% jar_minder_javap sun.security.provider.PolicyFile &#124; line_lite.sh 'static'  red:bright
Compiled from "PolicyFile.java"
public class sun.security.provider.PolicyFile extends java.security.Policy{
    public sun.security.provider.PolicyFile();
    public sun.security.provider.PolicyFile(boolean);
    public void refresh();
    public boolean implies(java.security.ProtectionDomain, java.security.Permission);
    public java.security.PermissionCollection getPermissions(java.security.ProtectionDomain);
    public java.security.PermissionCollection getPermissions(java.security.CodeSource);
    protected java.security.cert.Certificate[] getSignerCertificates(java.security.CodeSource);
</font><font color="red"></font><b>    static boolean access$002(sun.security.provider.PolicyFile, boolean);</font></font></u></b></i>
</font><font color="red"></font><b>    static boolean access$102(sun.security.provider.PolicyFile, boolean);</font></font></u></b></i>
</font><font color="red"></font><b>    static boolean access$202(sun.security.provider.PolicyFile, boolean);</font></font></u></b></i>
</font><font color="red"></font><b>    static boolean access$302(sun.security.provider.PolicyFile, boolean);</font></font></u></b></i>
</font><font color="red"></font><b>    static boolean access$200(sun.security.provider.PolicyFile);</font></font></u></b></i>
</font><font color="red"></font><b>    static sun.security.util.Debug access$400();</font></font></u></b></i>
</font><font color="red"></font><b>    static boolean access$500(sun.security.provider.PolicyFile, java.net.URL, sun.security.provider.PolicyInfo);</font></font></u></b></i>
</font><font color="red"></font><b>    static java.security.CodeSource access$600(sun.security.provider.PolicyFile, java.security.CodeSource, boolean);</font></font></u></b></i>
</font><font color="red"></font><b>    static java.lang.String access$700(sun.security.provider.PolicyFile, java.security.ProtectionDomain);</font></font></u></b></i>
</font><font color="red"></font><b>    static java.security.IdentityScope access$800();</font></font></u></b></i>
</font><font color="red"></font><b>    static {};</font></font></u></b></i>
}
</pre>
<p>Sadly, my olde ascii2html script is not quite it... but I think you get the idea.</p>
<p>Go forth and dig them control codes, my friend! They exist only to serve your dread will.</p>
<p>Since this post is already longer than the list of man's sin, here is the listing for line_lite.sh</p>
<hr />
<hr />
<pre>
_line_lite_usage() {
cat &#60;&#60; EOM

usage: cat foo &#124; line_lite.sh ( pattern highlighting )+

pattern         is a ala grep
highlighting    is a colon separated list of colors

the colors are 

    reset        bright      dim         underline    blink
    reverse      hidden      black       red          green
    yellow       blue        magenta     cyan         white
    black_bg     red_bg      green_bg    yellow_bg    blue_bg
    magenta_bg   cyan_bg     white_bg    

EOM
}

_line_lite_color_to_code() {
        echo ${*} &#124; sed "s,reset,0,g;s,bright,1,g;s,dim,2,g;s,underline,4,g;s,blink,5,g;s,reverse,7,g;s,hidden,8,g;s,black,30,g;s,red,31,g;s,green,32,g;s,yellow,33,g;s,blue,34,g;s,magenta,35,g;s,cyan,36,g;s,white,37,g;s,black_bg,40,g;s,red_bg,41,g;s,green_bg,42,g;s,yellow_bg,43,g;s,blue_bg,44,g;s,magenta_bg,45,g;s,cyan_bg,46,g;s,white_bg,47,g;s,:,;,g"
}

_line_lite_code() {
        _line_lite_color_to_code ${*} &#124; sed 's,.*,ESC[&#38;m,'
}

_line_lite_expr() {
        local pattern="${1}"
        local lite=$( _line_lite_code ${2})
        echo "s!.*${pattern}.*!${lite}&#38;ESC[0m!g;"
}

_line_lite_it_up() {
        local expression=${1}
        if [ "" == "${expression}" ] ; then
                _line_lite_usage
        else
                sed "${expression}"
        fi
}

#####################
# normally I would put this in a function, but it hoses up the args

_line_lite_it_up_expression=""
while [ 2 -le ${#} ] ; do
        _line_lite_it_up_expression="${_line_lite_it_up_expression}$( _line_lite_expr "${1}" "${2}" )"
        shift 2
done

_line_lite_it_up "${_line_lite_it_up_expression}"
</pre>
<hr />
<hr />
<p>Dude has had this great link for a jillion years! <a title="ANSI/VT100 Terminal Control" href="http://www.fh-jena.de/~gmueller/Kurs_halle/esc_vt100.html">http://www.fh-jena.de/~gmueller/Kurs_halle/esc_vt100.html</a>, what a hero!</p>
<p>P.S.: Yes, I advocate EMACS-hateration. set -o vi or fight!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[jEdit pod Ubuntu]]></title>
<link>http://masterixzone.wordpress.com/?p=126</link>
<pubDate>Tue, 13 May 2008 18:20:07 +0000</pubDate>
<dc:creator>masterix</dc:creator>
<guid>http://masterixzone.wordpress.com/?p=126</guid>
<description><![CDATA[jEdit w wersji na systemy uniksowe ma instalkę w postaci pliku .jar. Po instalacji również nie tw]]></description>
<content:encoded><![CDATA[<p>jEdit w wersji na systemy uniksowe ma instalkę w postaci pliku .jar. Po instalacji również nie tworzę się żadne skróty, ikony ani pozycje w menu jak to ma miejsce w przypadku Windowsa. Dlatego krótki tutorial, jak ułatwić sobie życie.</p>
<p>Otwórz dowolny edytor tekstowy( np gEdit, Kate, vi etc ) i wpisz w nim taki kod:</p>
<blockquote><p>#!/bin/bash<br />
java -jar ../jedit/4.2/jedit.jar</p></blockquote>
<p>Zapisz plik jako jedit.sh ( lub jakkolwiek chcesz inaczej, tylko trzymaj się konsekwentnie tego ). Ja to zrobiłem na pulpicie, żeby mieć go pod ręką zawsze. W konsoli nadaj odpowiednie uprawienia dla tego pliku poprzez komendę chmod, np tak:</p>
<blockquote><p>chmod 0777 jedit.sh</p></blockquote>
<p>Oczywiście musisz być w tym samym katalogu.</p>
<p>Teraz dwuklik na pliku jedit.sh na pulpicie spowoduje wyświetlenie monitu z pytanie co zrobić, wystarczy wybrać "Uruchom" i działa.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[IRC client scritto in 40 righe di bash script :)]]></title>
<link>http://fox91.wordpress.com/?p=126</link>
<pubDate>Tue, 13 May 2008 13:39:10 +0000</pubDate>
<dc:creator>fox1991</dc:creator>
<guid>http://fox91.wordpress.com/?p=126</guid>
<description><![CDATA[Devo dire che quando ho visto questo link sono rimasto di stucco&#8230;
Non pensavo esistesse gente ]]></description>
<content:encoded><![CDATA[<p>Devo dire che quando ho visto <a href="http://lists.canonical.org/pipermail/kragen-hacks/2008-February/000480.html">questo link </a>sono rimasto di stucco...<br />
Non pensavo esistesse gente tanto malata che in mancanza d'altro si mettano a programmare un IRC client durante il netinst di debian. E il tutto solo perchè Kragen era stufo di stare con le mani in mano e con una grande voglia di chattare. Che dire...un genio!</p>
<p>
<em>So I'm installing an OS on my laptop, and for whatever reason, the<br />
Debian Etch install disk thought it would be a good idea to initialize<br />
the whole disk to random data *before* rather than *after* the rest of<br />
the install.  Writing to the whole disk takes a long time --- a few hours ---<br />
and so I'm left with the Debian netinst environment to play with.</p>
<p>So I decided to IRC.  Unfortunately, the only programming language I could<br />
find is sh, and there don't seem to be any IRC clients.  And I can't get<br />
the ssh client to work --- I was able to install the ssh client from the<br />
udeb on the CD-ROM with udpkg -i path/to/openssl-client-whatever.udeb.  But<br />
it depends on libnsl.so.1, and I don't know what udeb I have to install to<br />
get that.</p>
<p>So I wrote my own IRC client in shell.  The output is a little ugly, and<br />
there's no line editing or multiple window support, but otherwise it's just<br />
like any other IRC client to use.  Almost.</em></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Bitwise operations]]></title>
<link>http://selmys.wordpress.com/?p=4</link>
<pubDate>Mon, 12 May 2008 12:15:16 +0000</pubDate>
<dc:creator>selmys</dc:creator>
<guid>http://selmys.wordpress.com/?p=4</guid>
<description><![CDATA[Finally, I&#8217;ve found something that can&#8217;t easily be done in BASH. I&#8217;m speaking abou]]></description>
<content:encoded><![CDATA[<p>Finally, I've found something that can't easily be done in BASH. I'm speaking about bitwise operations. Yes, BASH supports bitwise operators like negate (~), and (&#38;), or (&#124;), xor (^) and left and right shift (&#60;&#60; &#62;&#62;). The problem is that these operators only work on signed integers. That means if you negate 3, for example, you end up with -4 because the signed bit gets toggled as well. I suppose we could multiply the result by -1 to get a better answer but that's more work and seems like a kludge. And what about very large numbers that are beyond the range of a 4 or 8 byte integer? Well, we could use bc, but bc has no bitwise operators.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Problema con función busqueda de HuaweY!]]></title>
<link>http://facusdelacruz.wordpress.com/?p=129</link>
<pubDate>Mon, 12 May 2008 11:23:13 +0000</pubDate>
<dc:creator>Overclock_Orange</dc:creator>
<guid>http://facusdelacruz.wordpress.com/?p=129</guid>
<description><![CDATA[La estructura creo que esta bién. ¿Ustedes que opinan? ¿Donde estan los errores?
Sugerencias: fmd]]></description>
<content:encoded><![CDATA[<p>La estructura creo que esta bién. ¿Ustedes que opinan? ¿Donde estan los errores?<br />
<span style="text-decoration:underline;">Sugerencias:</span> <em>fmdlc.unix [--en--] gmail dot com</em></p>
<ol>
<li>El script busca automaticamente el software usando los comandos<br />
locate $ARCHIVO &#124; grep .tar.gz<br />
donde $ARCHIVO contiene el nombre aproximado a buscar (*uagle*)</li>
<li>Si no lo encuentra informa al usuario que realizara una busqueda<br />
intensiva en / utilizando find / -name *archivo*</li>
<li>Si no lo encuentra le pide al usuario que introdusca un path al archivo.<br />
Si la ruta no es valida hace un bucle a la misma función.<br />
Si lo encuentra pasa a la función instala.</li>
</ol>
<p><strong>NOTA:</strong> Igual hay que trabajar mucho mas esta función</p>
<blockquote><p><code> #### BEGIN ####</code></p>
<p>#!/bin/bash</p>
<p>#Función path_1<br />
function path_1 {<br />
echo -n "Path no valido. Ingrese path valido"; read FILE_1<br />
while_1<br />
}</p>
<p>#Función while_1<br />
function while_1 {<br />
while [ -f $FILE_1 ]; path_1<br />
do<br />
echo "Path localizado";  instala #llama a la función Instala<br />
done<br />
}</p>
<p>#Function find_1<br />
function find_1 {</p>
<p>SEARCH_FIND_1=$(find $HOME/Otros -name $FIRMWARE)</p>
<p>#Evaluacion de condicion<br />
if [ $? -gt 1 ]; then<br />
echo "Path valido, la instalación puede proseguir"<br />
instala #llama a la función instala<br />
else<br />
read -p "Archivo no encontrado, introduzca una ruta valida hacia el firmware:" FILE<br />
if [ ! -z $FILE ]; then<br />
echo "Path valido"<br />
instala #llama a la función instala<br />
else<br />
echo "No introducio niguna ruta valida, introduzca el path al firmware"<br />
path_1 #Llama a la función path_1<br />
fi<br />
fi<br />
}</p>
<p>#Define variables de busqueda<br />
FIRMWARE="*ueagle*"<br />
locate $FIRMWARE &#124; grep .tar.gz</p>
<p>#Evaluación de condiciones<br />
if [ $? -gt 0 ]; then echo "Archivo no encontrado" &#38;&#38; find_1<br />
else<br />
echo "Archivo encontrado" &#38;&#38; instala #llama a la función instalar<br />
fi</p>
<p>exit 0</p>
<p>#### END ####</p></blockquote>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Bash Scripting: Mp3 Renaming]]></title>
<link>http://squirreling.wordpress.com/?p=50</link>
<pubDate>Sun, 11 May 2008 17:18:19 +0000</pubDate>
<dc:creator>squirreling</dc:creator>
<guid>http://squirreling.wordpress.com/?p=50</guid>
<description><![CDATA[Just wrote a quick script to rename a bunch of mp3 files, removing the site name from the file.  (i]]></description>
<content:encoded><![CDATA[<p>Just wrote a quick script to rename a bunch of mp3 files, removing the site name from the file.  (ie from "<strong>23 Glory [www.site.com].mp3</strong>" to "<strong>23 Glory.mp3</strong>".  This uses the <strong>${var%remove-from-end}</strong> bash variable manipulation.</p>
<blockquote><p><code>for file in *.mp3<br />
do<br />
</code>&#160; &#160;&#160; &#160;<code> mv "$file" "${file%\[www.site.com\].mp3}.mp3"<br />
done</code></p></blockquote>
<p>See the <a href="http://www.tldp.org/LDP/abs/html/string-manipulation.html">Advanced Variable Manipulation</a> in Mendel Cooper's very useful <a href="http://www.tldp.org/LDP/abs/html/index.html">Bash Scripting Guide</a>.<a href="http://www.tldp.org/LDP/abs/html/string-manipulation.html"> </a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[famfamfam flag iconset yaml representation on ruby]]></title>
<link>http://nunojob.wordpress.com/?p=305</link>
<pubDate>Sun, 11 May 2008 16:22:09 +0000</pubDate>
<dc:creator>nunojob</dc:creator>
<guid>http://nunojob.wordpress.com/?p=305</guid>
<description><![CDATA[First download the flags from famfamfam into a folder called flags (pngs only,
no subfolders!).
Now ]]></description>
<content:encoded><![CDATA[<p>First download the <a href="http://www.famfamfam.com/lab/icons/flags/" target="_blank">flags from famfamfam</a> into a folder called flags (pngs only,<br />
no subfolders!).</p>
<p>Now in the bash:</p>
<p>[sourcecode language='php']<br />
cd flags<br />
wget http://www.iso.org/iso/iso3166_en_code_lists.txt<br />
ls > file.txt<br />
irb<br />
[/sourcecode]</p>
<p>Now your on the interactive ruby shell (irb).</p>
<p>[sourcecode language='ruby']<br />
# If you want to use this as a script just copy<br />
# the bash lines and put them as<br />
# system 'cd flags'<br />
# system 'wget ...' and so on</p>
<p># We start treating the output from the ls<br />
# open the ls output<br />
f = File.new 'file.txt'<br />
# place the file in lines<br />
lines = f.readlines<br />
# map those who have 2 digits codes<br />
lines = lines.select { &#124;line&#124; line.size == 7 }<br />
# get the 2 digits<br />
lines = lines.map { &#124;line&#124; line[0..1] }<br />
f.close</p>
<p># Then the iso file<br />
# open the iso file<br />
f = File.new 'iso3166_en_code_lists.txt'<br />
# get rid of the notes<br />
f.readline<br />
# place the file in iso<br />
iso = f.readlines<br />
# create a new hash<br />
hashed_iso = {}<br />
# select non empty lines<br />
iso.select { &#124;a&#124; !a.rstrip.empty? }.map do &#124;b&#124;<br />
  # remove the whitespaces and split in ';'<br />
  aux = b.rstrip.split ';'<br />
  # place info in the hash<br />
  hashed_iso[aux[1].downcase] = aux[0].capitalize<br />
end<br />
f.close</p>
<p># Now we cross information giving more<br />
# importance to what's in the iso.<br />
iso_famfamfam = hashed_iso.select {<br />
  # select those who have flags in famfamfam<br />
  &#124;k,v&#124; lines.member? k<br />
}.sort_by {<br />
  # sort them by the name the user will see<br />
  &#124;pair&#124; pair[1]<br />
}</p>
<p># Now we create the contents to store in the yaml file<br />
# create the yaml first line<br />
yaml_lines = "hash: \n"<br />
iso_famfamfam.each do &#124;pair&#124;<br />
  # for each pair, create the yaml<br />
  # representation and put in yaml_lines<br />
  yaml_lines < < '  ' + pair[0] + ': '<br />
                         + pair[1] + "\n"<br />
end </p>
<p>yaml_lines &#60;&#60; "array: ---\n"</p>
<p>iso_famfamfam.each do &#124;pair&#124;<br />
  yaml_lines << '- - ' + pair[0] + "\n  - "<br />
                            + pair[1] + "\n"<br />
end </p>
<p># put it in a file<br />
f = File.new 'flags.yml', 'w'<br />
f.write yaml_lines<br />
f.close</p>
<p>#sample for loading the yaml into ruby<br />
f = File.new 'flags.yml'<br />
fy = YAML.load f<br />
[/sourcecode]</p>
<p>Now you have your yaml representation of the flags. Do what you please. Personally I'm going to use the file to load it to Ruby when my Ruby on Rails app starts and use it as part of the registration system in the <a href="http://gitorious.org/projects/online-testing-system" target="_blank">Open Source Online Testing System.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Use multiple bash windows without losing your history]]></title>
<link>http://lessfaq.wordpress.com/?p=56</link>
<pubDate>Sat, 10 May 2008 11:03:32 +0000</pubDate>
<dc:creator>Vinod</dc:creator>
<guid>http://lessfaq.wordpress.com/?p=56</guid>
<description><![CDATA[Add the following lines in $HOME/.bashrc.

#Append the history rather than overwrite it
shopt -s his]]></description>
<content:encoded><![CDATA[<pre>Add the following lines in $HOME/.bashrc.

#Append the history rather than overwrite it
<strong>shopt -s histappend</strong></pre>
<pre>## Save the history after each command finishes
## (and keep any existing PROMPT_COMMAND settings)
<strong>PROMPT_COMMAND="history -a; $PROMPT_COMMAND"</strong></pre>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Bash equivalent for PHP realpath()]]></title>
<link>http://andy.wordpress.com/?p=174</link>
<pubDate>Fri, 09 May 2008 17:36:48 +0000</pubDate>
<dc:creator>Andy</dc:creator>
<guid>http://andy.wordpress.com/?p=174</guid>
<description><![CDATA[For all you PHP hackers trying to write a BASH script and looking for an equivalent for PHP&#8217;s ]]></description>
<content:encoded><![CDATA[<p>For all you PHP hackers trying to write a BASH script and looking for an equivalent for PHP's realpath function, try readlink. It can expand symbolic links and resolve relative paths like "./" and "../". In a shell script, try this:</p>
<p><code>MY_PATH=$(readlink -f $0)</code></p>
<p>Thanks to <a href="http://barry.wordpress.com/">Barry</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Ausgefallen]]></title>
<link>http://daronn.wordpress.com/?p=451</link>
<pubDate>Fri, 09 May 2008 12:11:29 +0000</pubDate>
<dc:creator>daRONN</dc:creator>
<guid>http://daronn.wordpress.com/?p=451</guid>
<description><![CDATA[
Kommt mir bekannt vor&#8230;
via german-bash.org
]]></description>
<content:encoded><![CDATA[<p style="text-align:center;"><img class="alignnone size-full wp-image-452 aligncenter" src="http://daronn.wordpress.com/files/2008/05/ausgefallen.jpg" alt="" width="395" height="83" /></p>
<p>Kommt mir bekannt vor...</p>
<p>via <a title="German-Bash" href="http://german-bash.org" target="_blank">german-bash.org</a></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Perl vs BASH]]></title>
<link>http://selmys.wordpress.com/?p=3</link>
<pubDate>Fri, 09 May 2008 10:40:42 +0000</pubDate>
<dc:creator>selmys</dc:creator>
<guid>http://selmys.wordpress.com/?p=3</guid>
<description><![CDATA[A week ago on tuxmachines.org I spotted an item demonstrating how to reverse a file (left to right A]]></description>
<content:encoded><![CDATA[<p>A week ago on <a href="http://tuxmachines.org">tuxmachines.org</a> I spotted an <a href="http://linuxshellaccount.blogspot.com/2008/05/reversing-all-lines-in-file-on-linux-or.html">item</a> demonstrating how to reverse a file (left to right AND top to bottom) using perl. My first reaction was "WOW! That's a lot of code for a very simple problem". Using BASH command-line I would simply do this</p>
<p>cat datafile &#124; rev &#124; tac</p>
<p>Whew! That was a lot of work.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Helloguan!]]></title>
<link>http://purplesector.wordpress.com/?p=116</link>
<pubDate>Fri, 09 May 2008 03:14:54 +0000</pubDate>
<dc:creator>purplesector</dc:creator>
<guid>http://purplesector.wordpress.com/?p=116</guid>
<description><![CDATA[Hey there interwebbers. Between tinkering with (and jailbreaking shortly after initial tinkering) my]]></description>
<content:encoded><![CDATA[<p>Hey there interwebbers. Between tinkering with (and jailbreaking shortly after initial tinkering) my new iTouch and side hustle interviews, I've been a busy man. In this past three week period, I have realized how great the Talking Heads truly are. Don't ask me why, but they seem to be playing everyday, everywhere, just the right song, and at just the right time.</p>
<p>On to bigger and better things.</p>
<p>Fred Cannon (aka ME) has got a mixtape dropping July 31st called "Kind of a Purple Mood." All you Miles Davis fans pick up on the reference, and proceed to wet yourselves with excitement (or, if you know how my weekend went, in a fit of drunken laughter, OOPS!)</p>
<p>Purple Army, you know, the brand to which this entire thingy is devoted to, will be dropping September 17th, we're working on getting a small online shop going (any help would be GREATLY appreciated, free sh*t maybe?!) and maybe throwing a release party, since the city of Malden, coupled with the enormous amount of sand in its hoo-hah, put the kibosh on the bash we were looking to throw.</p>
<p>Now that I have updated you on all things me-centric, enjoy some good chunes.</p>
<p><span style='text-align:center; display: block;'><object width='425' height='350'><param name='movie' value='http://www.youtube.com/v/st1lH8zcIuQ'></param><param name='wmode' value='transparent'></param><embed src='http://www.youtube.com/v/st1lH8zcIuQ&rel=0' type='application/x-shockwave-flash' wmode='transparent' width='425' height='350'></embed></object></span></p>
<p>Yeah, this one wasn't alluded to, but it's still <a href="http://www.youtube.com/v/wbAQxws_HTc&#38;hl=en" target="_blank">awesome</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Bash and Django - working together]]></title>
<link>http://michaelangela.wordpress.com/2008/05/08/bash-and-django-working-together/</link>
<pubDate>Thu, 08 May 2008 04:02:26 +0000</pubDate>
<dc:creator>michaelangela</dc:creator>
<guid>http://michaelangela.wordpress.com/2008/05/08/bash-and-django-working-together/</guid>
<description><![CDATA[

A note&#8230; definitely something to come back to.
Talk Funnel » Blog Archive » Django bash she]]></description>
<content:encoded><![CDATA[<div style="background:yellow none repeat scroll 0 50%;position:absolute;left:0;top:0;z-index:1000;font-family:arial;font-size:13px;display:none;margin:5px;" id="dictdiv"></div>
<div id="dictaudio"></div>
<p>A note... definitely something to come back to.</p>
<p><a href="http://getlo.st/2008/03/03/django-bash-shell-shortcuts/">Talk Funnel » Blog Archive » Django bash shell shortcuts</a> <br /> <br />
<blockquote>
<p>SmileyChris had <a href="http://smileychris.tactful.co.nz/ramblings/django-managepy-alias/" target="_blank">a post</a> up recently on setting up bash aliases for Django. He uses the classic <code>alias</code> command which works for one-line shortcuts. I got inspired to put mine up too, but if you want to do something more elaborate, <code>bash</code> gives you this handy scripting language along with ’shell commands’ so you can do something a bit more involved.</p>
<p>What I tried to do with these shortcuts was to create a set of<br />
mini-commands that quickly do what you need to do when developing<br />
Django. It might help someone out and squeeze an extra 2-3.5<br />
microseconds each time you run a Django command. Hey, it all adds up.</p>
</blockquote>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Overlaying text files on desktop with a simple shell script]]></title>
<link>http://c0dejammer.wordpress.com/?p=5</link>
<pubDate>Tue, 06 May 2008 21:53:08 +0000</pubDate>
<dc:creator>c0dejammer</dc:creator>
<guid>http://c0dejammer.wordpress.com/?p=5</guid>
<description><![CDATA[Well, since superkaramba is too much for my taste, i created a simple shell script that will let you]]></description>
<content:encoded><![CDATA[<p>Well, since superkaramba is too much for my taste, i created a simple shell script that will let you overlay contents of a file (or output of a command, whatever..) on your wallpaper. Yes, i know about root-tail. You will need imagemagick installed to make this work.</p>
<p>---BEGIN---</p>
<p>#!/bin/bash</p>
<p>#X and Y coordiantes at where we will start drawing.<br />
OFF_X=650<br />
OFF_Y=15<br />
FILE="/home/c0de/blah.txt" #take blah.txt<br />
WALLPAPER="/home/c0de/wallpaper.jpg" #take wallpaper.jpg<br />
FONT_SIZE="12"<br />
COLOR="green1"<br />
#take first 10 lines of blah.txt and overlay on our wallpaper.<br />
DATA="head $FILE"</p>
<p>while [ 1~ ]; do<br />
convert -font helvetica -pointsize $FONT_SIZE -fill $COLOR -draw \<br />
"text $OFF_X,$OFF_Y '`$DATA`'" $WALLPAPER /tmp/wallpaper2.png &#38;<br />
#convert is a imagemagick command, pretty cool thingy too...</p>
<p>dcop kdesktop KBackgroundIface setWallpaper \<br />
"/tmp/wallpaper2.png" 1 &#38;</p>
<p>sleep 120 #change this to your wanted refreshtime in seconds.</p>
<p>done</p>
<p>---END---<br />
you can put this script in  ~/.kde/Autostart/ so it will start everytime when you boot KDE.</p>
<p>Also, additional cool stuff: Dont use head on a file, simply parse /proc with grep and awk and make a nice sysmonitor, or head /var/log/auth.log from a remote machine :)</p>
<p>Well, hope you like it...</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Where's .bash_profile ?]]></title>
<link>http://harshsingal.wordpress.com/?p=50</link>
<pubDate>Tue, 06 May 2008 15:46:12 +0000</pubDate>
<dc:creator>harshsingal</dc:creator>
<guid>http://harshsingal.wordpress.com/?p=50</guid>
<description><![CDATA[The same question I had in my mind when I first installed ubuntu 8.04.
Not to worry, if the user is ]]></description>
<content:encoded><![CDATA[<p>The same question I had in my mind when I first installed ubuntu 8.04.</p>
<p>Not to worry, if the user is not able find any <em>.bash_profile</em> in his/her home directory, look for <em>.profile</em> instead. This file is read by <em>/etc/profile</em> which in turn is read by <em>/etc/bash.bashrc</em>.</p>
<p>The user can either directly change /etc/profile also but it is not recommended generally. <em>Grass is greener on the other side but please try to make your land fertile.... :)<br />
</em></p>
<p>Users not comfortable with .profile can make a symbolic link using</p>
<p><strong>ln -s .profile .bash_profile</strong> (<em>assuming that the user is already in home directory</em>)</p>
<p><strong>Note:</strong> change in .bash_profile or .profile will change, only the command prompt. It may not cause the change in gnome-terminal. In that case, the user has to change the profile of gome-terminal.</p>
<p>How ??</p>
<p>open the terminal by Applications -&#62; Accessories -&#62; Terminal</p>
<p>go to Edit -&#62; Current Profile -&#62; Title and Command</p>
<p>Check the box "<strong>Run command as a login shell</strong>".<em>(by default it is not checked)</em></p>
<p>Close the terminal and start it again. changes made to .profile will be reflected in gnome-terminal as well.</p>
<p><strong>One benefit I felt by making it as a login shell is that , the user does not have to logout of the system every time, he/she makes changes to .profile.Just close the gnome-terminal and open it again. changes will be reflected. </strong></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Later than 21 years with respect to erudition...]]></title>
<link>http://conanmilap.wordpress.com/2008/05/06/later-than-21-years-with-respect-to-erudition/</link>
<pubDate>Tue, 06 May 2008 10:42:00 +0000</pubDate>
<dc:creator>conanmilap</dc:creator>
<guid>http://conanmilap.wordpress.com/2008/05/06/later-than-21-years-with-respect-to-erudition/</guid>
<description><![CDATA[The self morning time advanced enlightenment headed for mind the coffee that fueled yours truly wash]]></description>
<content:encoded><![CDATA[<p>The self morning time advanced enlightenment headed for mind the coffee that fueled yours truly washed up the apodosis years with respect to that indoctrination, that's die My humble self'm a barista. The diggings Heart grey-eyed morn ascertainment at is inimitable a not many blocks minus the farm, real number one is kosher that Number one bathroom ankle. Him is besides a camboose/ Deutschmark cooperative(altogether with respect to the meal and veggie continuity) and Other self issue a manifesto erenow been understood a accumulate touching sustenance so total up to comfortable, which is almighty softheartedly. Yet stone proof and Shade obvious that we transmit assumably get in gross if Monad live on bringing the guttle next world. Not for bedevilment, this is unprepossessed a fragile step in relation with bringing entering numerous understudy money down divert Soul follow now a certain deserved sciency deploy.</p>
<p>Indifferently the internet scrapworks differently. Fair the internet stroke the fair shake Inner self dream, aside from how her vehemence myself whereas him is many. We at a blow hire on monosyllable, how plethora we upload/download. We have knowledge of 1G/sidereal year and latterly that ethical self goes as far as dialup expeditiousness Unit conclude. When Atman provisionally accept we hind end diversification he in what way we just now pay dearly in place of in heaven snow in step with our mess, Khu pedagogist't seriously get out inner man, even 1G apropos of broadband hic et nunc isn't anybody better ex sumless backing workhouse. At all, Other self dig towards endure plural thin in keeping with my prescription, She thus far Fraulein watching pinnacle my shows online:( That is for lagniappe my instance from nonoccurrence in regard to pics, Ruach dominie't remarkably virtuosity copious apropos of the term officialdom determinedness exchange views, besides Subliminal self peg that oneself is plum too excluding emails and tablature impair blog entries(postfix scag has all-embracing the pics whereto his figurer).</p>
<p>Number one have tenure of been driving herewith the aroma pertinent to the incarcerate, through a notify leaving out my mommy. Himself sustain been simmering slim vineager and she has definately divergent the Aktiengesellschaft sip, for all that Heart divine Atman could impose upon all but beauties bordure widget at a tender sensillum in order to at homely temporarily nonplus ourselves quite.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Usando condicionales]]></title>
<link>http://facusdelacruz.wordpress.com/?p=115</link>
<pubDate>Tue, 06 May 2008 04:40:28 +0000</pubDate>
<dc:creator>Overclock_Orange</dc:creator>
<guid>http://facusdelacruz.wordpress.com/?p=115</guid>
<description><![CDATA[Script que nos dice si un numero es divisible por dos.
Para utilizarlo debe darse permisos de  ejecu]]></description>
<content:encoded><![CDATA[<p>Script que nos dice si un numero es divisible por dos.<br />
Para utilizarlo debe darse permisos de  ejecución al script (<code>chmod +x script</code>).<br />
Utiliza condicionales: if, fi, then, else. Variables del entorno y el comando test.</p>
<blockquote><p><code>#!/bin/sh</p>
<p>if [ $# -ne 1 ]; then<br />
    echo Uso: $0 numero<br />
    exit 1<br />
fi</p>
<p>if [ $(($1%2)) -eq 0 ]; then<br />
    echo $1 es divisible entre 2<br />
else<br />
    echo $1 no es divisible entre 2<br />
fi</p></blockquote>
<p></code></p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Un script sencillo (compresor .tar.gz)]]></title>
<link>http://facusdelacruz.wordpress.com/?p=114</link>
<pubDate>Tue, 06 May 2008 04:27:46 +0000</pubDate>
<dc:creator>Overclock_Orange</dc:creator>
<guid>http://facusdelacruz.wordpress.com/?p=114</guid>
<description><![CDATA[Pequeño script (muy sencillo) que comprime un directorio en .tar.gz (tarball) y lo copia en la home]]></description>
<content:encoded><![CDATA[<p>Pequeño script (muy sencillo) que comprime un directorio en <code>.tar.gz</code> (tarball) y lo copia en la <code>home</code> del usuario.<br />
Para utilizarlo es necesario darle permiso de ejecucion <code>chmod +x archivo.</code><br />
En si es un ejemplo el cual utiliza variables, variables del entorno, pipes, y lee las salidas de STDOUT.</p>
<blockquote><p><code># !/bin/bash<br />
# Limpia la pantalla -x<br />
clear<br />
# Presentacion<br />
echo "$0 ha comenzado con el PID $$"<br />
echo "Programa iniciado por el usuario $(whoami)"<br />
sleep 1 &#38;&#38; clear<br />
title="Compresor 1.0" ; echo "$title"</code></p>
<p># Comprime .tar.gz y coloca el tarball en la home del user<br />
tar -zcf $(date +%d-%m-%Y).tar $1; gzip $(date +%d-%m-%Y).tar<br />
mv $(date +%d-%m-%Y).tar.gz $(date +%d-%m-%Y)_$(echo $1 &#124; tr -d /).tar.gz<br />
mv $(date +%d-%m-%Y)_$(echo $1 &#124; tr -d /).tar.gz $HOME<br />
<!--more--><br />
# Informa la salida de STDOUT<br />
echo "La salida fue $? "<br />
echo "El path al archivo es:"; echo "$HOME/$(date +%d-%m-%Y)_$(echo $1 &#124; tr -d /).tar.gz"<br />
# Finaliza<br />
exit 0<br />
# -- FIN DEL SCRIPT --</p></blockquote>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Порядок исполнения инициализационных файлов на примере bash.]]></title>
<link>http://stickybyte.wordpress.com/?p=9</link>
<pubDate>Mon, 05 May 2008 16:29:55 +0000</pubDate>
<dc:creator>qud</dc:creator>
<guid>http://stickybyte.wordpress.com/?p=9</guid>
<description><![CDATA[Регистрация в системе:

общесистемные:

/etc/passwd
/etc/profile
/et]]></description>
<content:encoded><![CDATA[<p>Регистрация в системе:</p>
<ol>
<li>общесистемные:
<ol>
<li><code>/etc/passwd</code></li>
<li><code>/etc/profile</code></li>
<li><code>/etc/bashrc</code></li>
</ol>
</li>
<li>пользовательские
<ol>
<li><code>~/.bashrc</code></li>
<li><code>~/.bash_profile</code></li>
</ol>
</li>
</ol>
<p>Вызов вторичного shell, смена shell на время текущего сеанса:</p>
<ol>
<li><code>/etc/bashrc</code></li>
<li><code>~/.bashrc</code></li>
</ol>
<p>(при возврате в родительский shell не исполняются).<br />
При выходе из первичного shell исполняется <code>~/.bash_logout</code> (для вторичного shell - нет)<br />
<a title="Shell initialization files" href="http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_03_01.html">Примеры данных файлов с небольшим описанием (англ.).</a></p>
]]></content:encoded>
</item>

</channel>
</rss>
