Showing posts with label shell script. Show all posts
Showing posts with label shell script. Show all posts

Sunday, December 4, 2011

Learn some Ruby syntaxes from company source code

I think the fastest way to catch up Ruby and Rails idiomatic of my new company is to learn from it directly instead of learning from other available tutorials or books. Below is my note on this learning.

Rake

Exec shell command


  • use back-quote such as `ls`
  • return string from stdout
  • access Process object with $? such as $?.success
  • (not related to Ruby) `command 2>/dev/null` get rid of stderr

- string.chomp to remove new line in end of string

RSpec a lot of things on https://www.relishapp.com/rspec

Monday, December 22, 2008

My first shell script

I'm the one of English Premiere league fans but my dorminitory doesn't provide TV channel for it. So I have to find out my own. Fortunately, there are several pirate channel available on the internet in the shape of p2p client. One of that is Sopcast

Sopcast provides very easy using application for Windows OS user but it's not me. For Linux user there are a program that can invoke by command line and you have to use your own media player to play it yourself (In fact, there are someone writing linux's front-end Sopcast but it's not work in the way I want)

My problem is that I can't remember the command to run it. Every weekend, I have to open README file of Sopcast for the program running instruction. So I decided to write a script to handle it automatically. And it's also my first shell script ever. Here it is.
#!/bin/sh

echo Start Sopcast at $1
/usr/local/bin/sp-sc $1 3908 8908 > /dev/null &
echo Waiting for Sopcast starting
sleep 10
vlc http://localhost:8908/tv.asf
From now on, any other weekend, no README file. This makes me love not-Windows OS more and more.

Collectd PostgreSQL Plugin

I couldn't find this link when searching with google https://www.collectd.org/documentation/manpages/collectd.conf.html#plugin-postgresq...