Unix iTOps Tube

Monday, May 14, 2012

Batch to Shell Question??

I know this is kindof a noob question, but Im trying to convert a simple batch file to shell, but Im new to shell scripting.



What would the following be in shell script:


Code:


setlocal

set OK=N



set CUR_DIR=%~dp0

set CURRENT_TIME=%TIME:~0, 1%%TIME:~1,1%%TIME:~3,2%%TIME:~6,2%%TIME:~9,2%


I've read up on setlocal and ~dp0 conversions to shell but I'm not sure... Also, Im not sure what set OK=N actually does.

But this is what I've come up with...




Code:


export LC_ALL=C

export OK=N



export CUR_DIR=$(dirname $0)

export CURRENT_TIME=$(date "+ %H%M%S")


Not Sure if its correct at all because Im not sure what setlocal and OK=N is actually doing on a windows machine vs mac/unix.

Also, couldn't figure out how to get the milliseconds in there like the batch file...



Any help would be appreciated...

Thanks




Cool Websites and Tools [May 12th 2012]

Check out some of the latest MakeUseOf discoveries. Most of the listed websites are FREE or come with a decent free account option. If you want to have similar cool website round-ups delivered to your daily email, subscribe here.


Add Your Website Here!










My image

 


Urban Dictionary TV – For those of you who have already visited Urban Dictionary to find out the meaning of some senseless word – UrbanDictionary TV is just another website based on that, but now combined with videos to show you what they are trying to say. For example, the word "Dog" – which means "not a cat" – has a video of a dog skateboarding around a local park. Read more: UrbanDictionary TV: Learn Word Definitions With Help of Videos

































My image

 


MetaTrader 4 – n today's fast age, everything is high speed – even business. This is particularly true when it comes to Forex trading. Currency rates vary in real time and a good Forex trader will stay updated with the varying currency rates as frequently as they can. Additionally they will opt for the quickest way to buy and sell currencies. Both of these actions are facilitated by an app called MetaTrader 4. Read more: MetaTrader 4: A Highly Powerful App That Brings Trading Forex To Your Smartphone

 


My image

 


Swole – Health conscious individuals will always have the urge to diet, but it can also be a gruelling process especially if you do not have a set plan. What we need is a tool to tell us what to eat exactly and not think about having a meal plan everyday. This is where Swole comes into play. Swole generates a diet plan for you based on your calorie targets and set meals in a day. Read more: Swole: Free Tool To Generate Daily Diet Plans

 


My image

 


DailyPages – We spend a lot of time online. Sites like Facebook and YouTube kill our productivity and dumb our brain. Here to refresh the Internet experience by providing you with a dose of smartness is a web service called Daily Pages, a free to use web service that will email you a chapter of a book every so often. Read more: DailyPag.es: Get A Chapter Of A Book Emailed To You Every So Often

 


My image

 


Unsubscribr – Many of us have idle email boxes that we don't check that frequently and as a result they get spammed by lots of mailing lists. Somebody has realized that unsubscribing from lots of bulk lists manually is a pain and has therefore invented a great tool called Unsubscribr. Read more: Unsubscribr: Automatically Scans Your Inbox & Let You Unsubscribe From Mailing Lists In Bulk

 



These are just half of the websites that we discovered in the last couple of days. If you want us to send you daily round-ups of all cool websites we come across, leave your email here. Or follow us via RSS feed.











[bash] Reading two files and change a specific field

Hi all.



I have 2 files like these:



file1


Code:


3    -2    5    4    .    .    .

 3    3    3    4    .    .    .

 2    2    3    4    .    .    .

3    -2    8    4    .    .    .


file2


Code:


0.4242    2    3    4    .    .    .

 2.562    7    3    4    .    .    .

 0.7242    5    5    4    .    .    .

1.1242    -2    3    4    .    .    .


and I need to read every lines from file1, cheking if ($1==3 && $2==-2) and modifying $3 to 77 in the corresponding line in file2.



The result should be:



Outputfile


Code:


0.4242    2    77    4    .    .    .

  2.562    7    3    4    .    .    .

  0.7242    5    5    4    .    .    .

 1.1242    -2    77  4    .    .    .


I am trying in bash with:




Code:


awk ' FS ="\t" ;{ if ($1==3 && $2==-2) {getline < "file2" ; $3=77; print $0} else {getline < "file2" ; print $0}  }' file1

but there is a problem with the field separator. It seems like '\t' is not applied. :wall:



Any suggestion?



Maybe is it simplier in python?



Thank you in advance!




Error opening device: /dev/fscsi0

Hello,

One one of my AIX boxes I'm having the following errror:




Code:


fcstat fcs0:



Port Speed (supported): 4 GBIT

Error opening device: /dev/fscsi0

errno: 0000003d


Has anyone encountered similar errors?



Thank you!




[bash] Reading two files and change a specific field

Hi all.



I have 2 files like these:



file1


Code:


3    -2    5    4    .    .    .

 3    3    3    4    .    .    .

 2    2    3    4    .    .    .

3    -2    8    4    .    .    .


file2


Code:


0.4242    2    3    4    .    .    .

 2.562    7    3    4    .    .    .

 0.7242    5    5    4    .    .    .

1.1242    -2    3    4    .    .    .


and I need to read every lines from file1, cheking if ($1==3 && $2==-2) and modifying $3 to 77 in the corresponding line in file2.



The result should be:



Outputfile


Code:


0.4242    2    77    4    .    .    .

  2.562    7    3    4    .    .    .

  0.7242    5    5    4    .    .    .

 1.1242    -2    77  4    .    .    .


I am trying in bash with:




Code:


awk ' FS ="\t" ;{ if ($1==3 && $2==-2) {getline < "file2" ; $3=77; print $0} else {getline < "file2" ; print $0}  }' file1

but there is a problem with the field separator. It seems like '\t' is not applied. :wall:



Any suggestion?



Maybe is it simplier in python?



Thank you in advance!




INFOGRAPHIC : The Big Business Of Apple

The fact that Apple is rolling in mountains of cash is hardly a newsflash. Just weeks away from bankruptcy15 years ago, it is now the most valuable company in the world with revenues that could sustain small nations or help to wipe out the US national debt. But you may be shocked to learn the extent to which Apple is rolling in the Benjamins.  Even I did a double-take when this infographic claimed that Apple’s profits in the last 6 months were close to $30 billion.  I had to double-check the figure with Apple’s Press Office on their website and indeed the figure is correct.  That is just stunning.


Figures like that put them ahead of Google and Microsoft, and it’s all down to 2 devices – the iPhone and the iPad.  These two babies sell like the proverbial hotcakes and they are literally banknote printing machines for Cupertino. However, can they keep up this relentless pace? Will iPhones and iPads continue to fly out of shop doors or will demand eventually dry up?  That is our question to you today for the comments.  Is the flow of money unstoppable for Apple or will the well eventually run dry?


Big Business of Apple


Created by: BusinessDegree.net











4 Ways To Make Your Blog Pay Real Money

blog for moneyWriting a popular blog, getting famous, and then living off the Internet from a desert island beach are faily common dreams for many aspiring bloggers. With the advent of content management systems such as WordPress which make it incredibly easy to get a professional looking websites up and running in no time - full of sophisticated features –  the only thing really holding you back is your talent. “It’s too difficult to set up a website” really isn’t an excuse anymore. For your consideration then, here are 4 of the most popular ways to make your blogging pay.


This is a preview of my upcoming free MakeUseOf guide, a full manual of everything you need to know about blog monetization, due for release in a few months time (just as soon as I get around to actually finishing it!).


Banner Advertising


The most common form of website monetization today, online ads have never had a particular good public perception: from malicious Javascript injection to autoplaying videos, content-blocking popups and user activity tracking – many users are turning to Adblock plugins to declutter their web experience. Large ad networks such as Google Adsense are very easy to implement, and produce a pretty reliable income proportional to the number of visitors. If you’d like more control over your ads though – ensuring only relevant content is shown to your readers – the BuySellAds network is perfect for bloggers.


As well as being able to approve every ad before it’s displayed, and set your own pricing strategies (a fixed monthly cost, or traditional pay-per-click), you will also have the benefit of being listed in the directory from which advertisers can choose appropriate sites. The end result – content appropriate ads that users won’t feel the need to block.


blog for money


Affiliate Marketing


Affiliate marketing refers to the practice of linking to products or services in exchange for a small kickback when users purchase or sign up, through you. Typically it involves using a trackable customised link, and some programs such as Amazon will even place a cookie on the user’s browser for a certain number of days, so that you will be paid even if the purchase isn’t immediate or the user goes on to purchase additional items than the one you specifically linked to.


While this sounds like easy money, the truth is that affiliate marketing is very difficult. If you’d like to learn more, Matt wrote this informative article on the topic.


blog make money online


Donations & Flattr


Flattr is an easy way to accept micropayment type donations without having to ask for users payment details. The Flattr button is placed in a similar way to a Facebook Like or Tweet button; subscribers to the Flattr service contribute a self determined amount to their Flattr account each month. As they go about their Internet travels, they click the Flattr button for sites or articles they have appreciated; then at the end of the month their funds are divided up equally to all the sites they “flattered”.


Given that the number of Flattr users is still quite small and the amount given from a single Flattr is likely to be less than a dollar anyway, you shouldn’t expect to make a huge amount with this. Still, if you’re the type of blogger producing content that users are vocal about thanking you for, it can’t hurt to add just another button to your social icons at the bottom of every post, and it may at least pay for your hosting. It also has the added advantage of being non-intrusive, and AdBlock users may actually seek out Flattr buttons to reward sites they enjoy.


blog make money online


Sponsored Blogging


Entry requirements are strict, but sponsored blogging platforms such as SocialSpark allow influential bloggers to receive free gadgets and goods in exchange for positive reviews, as well as the basic paid blog post. You have to actually write the review of course, typically contain a certain number of keywords and links, but the advertisers pay reliably and you can expect anywhere from $5-$50 per post. Blogs with a higher PageRank and greater traffic garner the best offers, naturally.


Angela wrote about a number of other sponsored blog opportunities back in 2010, most of which are still operational.


blog make money online


Of course, this may not be something that your readership appreciates, and some users user will be quite offended by the idea of advertising disguised as content. Be sure to only accept offers from services relevant to your readers, and try to differentiate it from regular articles with a standout paragraph or note.


Traffic Should Be Your Priority


Before you jump onto any of the methods outlined, be warned that nothing will actually generate revenue unless you have a good flow of traffic already visiting your site. In fact, it may even be harmful to start monetizing your blog too early, as many forms of online advertising will put off visitors, driving them to the back button faster than you can say CPC.


If you’re hitting less than 1,000 page-views a day, I’d say it’s simply not worth bothering yet. If you have no idea how much traffic you’re getting, be sure to read through Ryan’s quick guide on using the new Google Analytics features.


blog for money


No worries if your site isn’t quite up to scratch yet though – now would be a great time to read though my 8 proven tips to make your blog popular. By the time you’re done implementing them, my full monetization guide will have been released!


Do you have any other great monetization ideas? I’d really love to hear about them in the comments (no affiliate links please). What is your experience with the methods I outlined here – have you found one in particular to be more effective?


Image credit: Shutterstock – typewriter











11 Free MP3 Album And EP Downloads For Your Weekly Audio Workout [Sound Sunday]

free musicSound Sunday is a weekly feature promoting free album downloads. Every edition invites you to explore various genres and artists from around the world. This edition contains several samplers and a remix album, embedded in a selection of full length albums and EPs. Dig in and pick what you like.


Note that name your price albums can be downloaded for free by entering 0 in the price field. That said, we strongly recommend you to donate a few dollars for music you enjoy!


We welcome you to submit your music, send suggestions with free albums you have discovered, or request genres we haven't covered in a while. For all Sound Sunday related inquiries, please contact Tina [tina at makeuseof dot com].


One Minute Millionaires – Drunkards and Fools


Genre: indie, rock, americana, alt-country, roots



One Minute Millionaires is an indie rock band from Gilbert, Arizona. Mark, Pete, Wayne, and Mike formed the band in 2008 and released their debut EP Drunkards and Fools in 2011. Their influences range from guitar oriented classic rock to hard rock. Subsequently, their sounds has been described as a mix of musicians like the Gin Blossoms, Spin Doctors, Credence Clearwater Revival, and Tom Petty.


Drunkards and Fools is a free download from SoundCloud (one song at a time). Alternatively, you can download a ZIP archive of the entire album, which was provided by the band via MediaFire: MP3 or WAV


Debeli Precjednik / Fat Prezident – Bruto Slavo / VBK


Genre: alternative, indie, hardcore, punk, rock


Bruto Slavo / VBK by DEBELI PRECJEDNIK / FAT PREZIDENT


From their Facebook page: “DEBELI PRECJEDNIK / FAT PREZIDENT formed in 1993 as a four piece. The band’s first official release was 1996′s self titled 7″ on Dirty Old Town Records, followed by Rat (Her) Burnt His Record, a debut full length released through the same label. DEBELI PRECJEDNIK / FAT PREZIDENT then hit the road, and hailed through the Europe as a meteor shower outshining the moon. The release of the next EP titled Tribute To Zli Farmeri was a solid bridge that led the band to the sophomore album titled Fist From The East. Fist From The East was released in 2003 through Double Penetration Records.


Bruto Slavo / VBK is a name your price download from Bandcamp.


Talk To Angels – Enemies Closer EP


Genre: alternative, pop, rock


Enemies Closer EP by Talk To Angels


From their Facebook page: “Mickey and Craig met at a house party, and once everyone else had gone home, they sat up all night, talking about a mutual love of certain bands and figured out they should start a band, write some songs together, and make use of the recording equipment Mickey had laying around his basement.

The band were invited to play CMJ in NYC in 2008, and since then they have concentrated on completing their debut album This Broken Home, as well as gigging extensively.


Enemies Closer EP is a free download from Bandcamp.


Scottish Fiction – April 2012 EP


Genre: alternative, indie,


Scottish Fiction April 2012 EP by Scottish Fiction


From the blog: “As anyone will tell you those who cannot do, teach. Well in my case the saying should go, ‘those who cannot do, preach’. Scottish Fiction, aside from being an Idlewild reference, is my attempt at just that. Not content with the bland and money grabbing dross that fills our radio waves, and without the necessary musical ability to do anything about it, Scottish Fiction is one man’s attempt to promote, discover, and introduce new (and old) music. I attempt this through this blog which you are reading, and also via the means of community radio, where you can hear my ramblings on Pulse 98.4 FM (or online at www.pulseonair.co.uk).


April 2012 EP is a free download from Bandcamp.


Riverview Studios – HarpoonFest 2012 Music Sampler


Genre: alternative, country, americana, pop, rock sampler


HarpoonFest 2012 Music Sampler by Riverview Studios


HarpoonFest is a music festival held by Boston based Harpoon Brewery. This year’s HarpoonFest is held on May 18th and 19th. From the album page: “While HarpoonFest 2012 will have stellar cover acts like Timberfakes, The New Originals and Dueling Pianos to name a few – here is an exclusive sampling of our outstanding original acts including 5 Boston Music Award winners. Take a second to share this free compilation on Twitter and Facebook. HarpoonFest is May 18th & 19th at Harpoon Brewery in Boston.


HarpoonFest 2012 Music Sampler is a free download from Bandcamp.


Independent Music News – Alternative / Metal Artists 2012


Genre: independent, local music, unsigned, pop, rock


Independent Music News // Alternative/Metal Artists 2012 by Independent Music News


From their Facebook page: “IMN is independent and created with objectivity, whatever artist/band. We cut out the alliances ideologically created by mainstream magazines. If you’re sick of reviews that don’t transcend impartiality, read our music website.

Their Bandcamp discography includes samplers from rock, folk, and indie artists.


Alternative / Metal Artists 2012 is a free download from Bandcamp.


Melody Sunrise Studio – Melody Sunrise Comp 2011


Genre: alternative, indie, acoustic, electronic, folk, jazz, reggae, rock, hip hop


Melody Sunrise Comp 2011 by Melody Sunrise Studio


From their MySpace page: “Melody Sunrise is less like traditional recording studio and more like a creative center to make those epic tracks you hear in your head. Many of the songs created here have been used on a number of different mediums including national/international television, major radio stations and independent movies.

From the album page: “2011 was another great year for creativity. A lot of amazing songs finished and everyone really pushed themselves to be the very best they could be. As always it has been an honor to produce all these talented people. Please click on each song to find out more about the groups and their projects.


Melody Sunrise Comp 2011 is a free download from Bandcamp.


Kotow – Escape Plan


Genre: electronic, rock, hard rock



Kotow is a music side project by British drummer and guitarist David Oakes. Escape Plan was released in 2008.


Escape Plan is a free download from SoundCloud.


Manny X – Songs About H.E.R.


Genre: acoustic, dance, pop, soul, rhythm’n'blues


Songs About H.E.R. by Manny X


From the album page: “In this life we seek, we find and along the way we experience that which defines us. For the past 2 yrs I’ve worked diligently to create audible accounts of the events that have occurred and the experiences they entailed. The culmination of this journey results in an album titled “Songs About H.E.R.”

H.E.R. = Having Experienced Relationships.


Songs About H.E.R. is a free download from Bandcamp.


Tiara Wiles – RE:Dux


Genre: electronic, experimental, dance, electro pop, soul, rhythm’n'blues, hip hop


RE:Dux by Tiara Wiles


Tiara Wiles is a singer, songwriter from Pittsburgh, Pennsylvania. Follow here on Twitter.


RE:Dux is a free download from Bandcamp.


Eddy J. Free – REMIXES VOL. 1


Genre: electronic, remix, soul, pop, hip hop, dubstep


REMIXES VOL. 1 by Eddy J. Free


From his Facebook page: “Eddy J. Free's background in classical and church music, as well as his love for hip-hop, R&B and jazz, has paved the way for many opportunities: he’s composed music for MTV, worked with a variety of artists and co-produced with multi-platinum producer Kayo (LaFace Records, Toni Braxton, TLC). He’s had the opportunity to work with legendary jazz bassist Charlie Haden and be in the studio with bassist/award-winning producer Andrew Gouche (Mary Mary, Warren G, The Winans and Chaka Khan) among others.


REMIXES VOL. 1 is a free download from Bandcamp.


New to Sound Sunday? Past editions of Sound Sunday are available here.


Feel free to get in touch with me [tina at makeuseof dot com] to share free material, suggestions, and feedback or simply add your comments below.