Игорь Олемской — практические заметки по системному администрированию Linux CentOS

Архив тега ‘twitter’

Twitter from command line (перепечатка)

Комментариев нет

Some time ago, I wrote a small script to Twitter from command line. As the basic authentication have been deprecated, I decide to write a new version.

As always, I wrote it in PHP with the pecl/Oauth extension, available in the fedora repository (and in remi for old versions or Enterprise linux).
You can download it from https://github.com/remicollet/twit.
A very useful example: Using pecl/oauth to post to Twitter
Installation
$ su -c «yum install php-pecl-oauth»$ wget... Lire Twitter from command line

Do professional certifications belong in your e-mail signature? (перепечатка)

Комментариев нет

After a discussion amongst coworkers about professional certifications in e-mail signatures yesterday, I decided to throw the question out to href="http://twitter.com/rackerhacker/">Twitter to gather some feedback:

href="http://twitter.com/rackerhacker">rackerhacker: Quick Twitter poll for the nerds: How many certification abbreviations do you put in your e-mail signature? [ href="http://twitter.com/RackerHacker/status/27448088177">Permalink]

The question must have struck a nerve with folks as I had over 50 replies in less than 10-15 minutes. I expected to hear a lot of people say «zero», and there were quite a few responses that didn't surprise me:

href="http://twitter.com/minter">minter: @RackerHacker Zero /> href="http://twitter.com/stwange">stwange: @RackerHacker none it's pretentious /> href="http://twitter.com/nickboldt">nickboldt: @RackerHacker Zero. My cert-fu is weak. /> href="http://twitter.com/scassiba/status/27448504377">scassiba: @RackerHacker none, I don't feel it's necessary to fluff up an email signature with certifications /> href="http://twitter.com/errr_">errr_: @RackerHacker 0 /> href="http://twitter.com/chrstphrbrwn">chrstphrbrwn: @RackerHacker Zero. I don't use an email signature. /> href="http://twitter.com/DamianZaremba">DamianZaremba: @RackerHacker none, makes you look a bit stuck up imo /> href="http://twitter.com/saiweb">saiweb: @RackerHacker 0 /> href="http://twitter.com/jirahcox">jirahcox: @RackerHacker 0. Job title only if absolutely necessary. /> href="http://twitter.com/jtimberman">jtimberman: @RackerHacker None mine are almost all expired anyway src='http://cdn.rackerhacker.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> /> href="http://twitter.com/ckeck">ckeck: @RackerHacker zero /> href="http://twitter.com/billblum">billblum: @RackerHacker None. /> href="http://twitter.com/puppetmasterd">puppetmasterd: @RackerHacker zero, or preferably fewer /> href="http://twitter.com/ripienaar">ripienaar: @RackerHacker zero, they dont add value. Much rather link me to your github account so I can make up my own mind src='http://cdn.rackerhacker.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> /> href="http://twitter.com/redbluemagenta">redbluemagenta: @RackerHacker None. People can see for themselves through other avenues (blog, github, references) if you're any good. /> href="http://twitter.com/ubuntusoren">ubuntusoren: @RackerHacker none

There were a few people who disagreed:

href="http://twitter.com/bwwhite">bwwhite: @RackerHacker Just one because that's all I have src='http://cdn.rackerhacker.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> But I think 2 should be the limit. Pick the 2 most relevant to your current role /> href="http://twitter.com/jwgoerlich">jwgoerlich: Generally 2. Depends on the email topic. /> href="http://twitter.com/whitenheimer">whitenheimer: @RackerHacker just one, some of them aren't worth putting /> href="http://twitter.com/russjohnson">russjohnson: @RackerHacker Currently none but have done upto 4 /> href="http://twitter.com/rbp1987">rbp1987: @RackerHacker I only put the most relevant or the highest level of cert that i have. Why what do you do at the moment? /> href="http://twitter.com/hotshotsphoto">hotshotsphoto: @RackerHacker MCP, MCP+I, CNA MCSE ITIL Practitioner...but only when I'm working in the IT field

There were quite a few that were strongly worded or humorous:

href="http://twitter.com/rjamestaylor">rjamestaylor: @RackerHacker I hate them — R Taylor, SCJP, MCP, RHCP, BSci, SAG /> href="http://twitter.com/mshuler">mshuler: .@RackerHacker I regard email signatures similar to SUVs — the size is relevant to the compensation factor /> href="http://twitter.com/iota">iota: @RackerHacker zero; as number of reported certifications increase, respect for sender decreases — my law #1514 /> href="http://twitter.com/raykrueger">raykrueger: @RackerHacker href="http://theoatmeal.com/comics/email">http://theoatmeal.com/comics/email /> href="http://twitter.com/hjv">hjv: @RackerHacker I'm Ebay A+++ Certified. /> href="http://twitter.com/unixdaemon">unixdaemon: @puppetmasterd @RackerHacker I'd love to see «Failed my MCP due to realising 10 minutes in that it would taint my soul. Forever.» on a CV. /> href="http://twitter.com/swimsaftereatin">swimsaftereatin: @mshuler @RackerHacker And ASCII art is to the signature as a huge purple spoiler is to a pickup truck. /> href="http://twitter.com/anoopbhat">anoopbhat: @RackerHacker none. unless there is a cert whose acronym is BADASS. /> href="http://twitter.com/sarahvdv">sarahvdv: @RackerHacker None because I only have one and it's almost embarrassing to put «CompTIA Network+ Certified» in my signature. /> href="http://twitter.com/0x44">0×44: @RackerHacker Zero. Certifications are nerd short-hand for «Don't hire me.»

I'm certainly not against certifications — they're a good way for vendors to ensure that there are trained professionals that meet a certain set of minimum knowledge levels about their product. When you hire someone with a particular certification, you should be able to assume that they have this minimum knowledge level (for most certifications).

However, a certification says absolutely nothing about how a job candidate has actually applied these skills to their previous work. For example, consider a systems administrator with a CCNA. If you ask the job applicant something like «So, how much experience do you have working with Cisco» for a Cisco-heavy job position and they reply that they've set up a Cisco PIX a few times, but they mainly focus on Linux administration, then what is that certification worth to your company?

As for e-mail signatures, I'd leave out the certifications. If you're sending e-mails to coworkers that you already know, there shouldn't any reason for you to «fluff» your signature with those abbreviations. They should already be familiar with your abilities and the addition of certifications to the e-mail doesn't add anything valuable to the e-mail itself. If you're sending e-mails to people you don't know (especially for a job), it makes your e-mail look pretentious.

href="http://rackerhacker.com/2010/10/16/do-professional-certifications-belong-in-your-e-mail-signature/">Do professional certifications belong in your e-mail signature? is a post from: Major Hayden's href="http://rackerhacker.com">Racker Hacker blog. style="display: none; visibility: hidden;">c0b6ad7e-f251-11df-b20b-4040336e00ef

Reincarnation of Twitter's realtime XMPP search term tracking with ruby (перепечатка)

Комментариев нет

When Twitter was still in its early stages, you could track certain search terms in near-realtime via Jabber. It was quite popular and its performance degraded over time as more users signed up and began posting updates. Eventually, Twitter killed the jabber bot altogether. Many users have asked when it will return.

Well, it hasn't returned, but you can build your own replacement with ruby, a jabber account, and a few gems. While it won't do everything that the original jabber bot did, you can still track tweets mentioning certain terms very quickly.

Here's how to get started:

First, install the tweetstream and xmpp4r-simple gems:

gem install tweetstream xmpp4r-simple

Next, you'll need a jabber account. You'll probably want to make one for the exclusive use of your jabber bot. I chose to make up a quick account at ChatMask for mine.

The last step is to drop a copy of this script on your server:

#!/usr/bin/ruby
require 'rubygems'
require 'tweetstream/client'
require 'tweetstream/hash'
require 'tweetstream/status'
require 'tweetstream/user'
require 'tweetstream/daemon'
require 'xmpp4r-simple'
 
jabber = Jabber::Simple.new('jabberbot@yourjabberserver.com','jabberpassword')
 
tweets = TweetStream::Client.new(twitterusername,twitterpassword)
 
tweets.track('celtics','lakers','finals','nba') do |status, client|
  imtext = "#{status.user.screen_name}: #{status.text} \r\n"
  imtext += "[http://twitter.com/#{status.user.screen_name}/status/#{status.id}]"
  jabber.deliver("yourjabberusername@yourjabberserver.com",imtext)
end
 
jabber.disconnect

You'll want to be sure to fill in the following:

  • your jabber bot's username and password
  • the username and password for the twitter account that will monitor the stream
  • the search terms you want to track
  • the destination jabber account where the messages should be sent

Ensure that your jabber account has authorized the jabber bot's account so that you'll actually receive the messages. Also, Twitter is very strict with their streaming API tracking terms. It's a good idea to review their entire Streaming API documentation to ensure that you're not going to end up having your account temporarily or permanently blacklisted.

Once everything is ready to go, you can just run the script within GNU screen or via nohup. There's still a bit more error checking to do around jabber reconnections, but the script has run non-stop for well over two weeks at a time without a failure.

Reincarnation of Twitter's realtime XMPP search term tracking with ruby is a post from: Major Hayden's Racker Hacker blog.

c0b6ad7e-f251-11df-b20b-4040336e00ef

Idiot's guide to OAuth logins for Twitter (перепечатка)

Комментариев нет

It certainly shouldn't be difficult, but I always have a tough time with OAuth. Twitter is dropping support for basic authentication on June 30th, 2010. I have some automated Twitter bots that need an upgrade, so I've been working on a quick solution to generate tokens for my scripts.

I formulated a pretty simple script using John Nunemaker's twitter gem that will get it done manually for any scripts you have that read from or update Twitter:

#!/usr/bin/ruby
require 'rubygems'
require 'twitter'
 
# These credentials are specific to your *application* and not your *user*
# Get these credentials from Twitter directly: http://twitter.com/apps
application_token = '[this should be the shorter one]'
application_secret = '[this should be the longer one]'
 
oauth = Twitter::OAuth.new(application_token,application_secret)
 
request_token = oauth.request_token.token
request_secret = oauth.request_token.secret
puts "Request token => #{request_token}"
puts "Request secret => #{request_secret}"
puts "Authentication URL => #{oauth.request_token.authorize_url}"
 
print "Provide the PIN that Twitter gave you here: "
pin = gets.chomp
 
oauth.authorize_from_request(request_token,request_secret,pin)
access_token = oauth.access_token.token
access_secret = oauth.access_token.secret
puts "Access token => #{oauth.access_token.token}"
puts "Access secret => #{oauth.access_token.secret}"
 
oauth.authorize_from_access(access_token, access_secret)
twitter = Twitter::Base.new(oauth)
puts twitter.friends_timeline(:count => 1)

When you run the script, it will give you a request token, request secret and a URL to visit. When you access the URL, you'll be given a PIN. Type the PIN into the prompt and you'll get your access token and secret. This is what you can use to continue authenticating with Twitter, so be sure to save the access token and secret.

From then on, you should be able to login with a script like this:

#!/usr/bin/ruby
require 'rubygems'
require 'twitter'
 
application_token = '[this should be the shorter one]'
application_secret = '[this should be the longer one]'
 
oauth = Twitter::OAuth.new(application_token,application_secret)
 
oauth.authorize_from_access(access_token, access_secret)
twitter = Twitter::Base.new(oauth)
puts twitter.friends_timeline(:count => 1)

I hope this helps!

Idiot's guide to OAuth logins for Twitter is a post from: Major Hayden's Racker Hacker blog.

c0b6ad7e-f251-11df-b20b-4040336e00ef