Archive for the ‘twitter’ tag
2010
My blog has served me throughout the years as a getaway medium. I've found comfort writing its pages, and more recently, writing a little bit more of my technical life and whereabouts. The personal side of it, in spite of being very well handled in the past, has been left behind in recent times. And I believe Twitter has taken that part of my postings. However, I believe that a lot of the thing I'm currently doing in my life are based on the measurable fact of the impact or weight that those actions would have on my Twitter (and Facebook for that matter) stream and contacts. This has also prevented me from developing further interests and getting deep into more interesting or worthwhile affairs. All the time spent reading and watching what others are doing, what I'm not doing and show what I do or pretend I'm doing has affected social relationships of mine and, as said, damaged, my growing or professional aspiring persona, that it even hurts deep down.
2010 marks the beginning of a lot of stuff and new plans, as usual. But it also marks the end of that ill poison I'm usually infected with. I want to grow up and move on to more interesting matters, retake the life I'm supposed to live and spend with the people I deserve.
Here, then, is for 2010.
✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌✌
Yes, those are twenty-five hands. As of yesterday 8/8, I turned 25. Thanks to all of you who shouted out on Facebook, Twitter or elsewhere.
Oh, the ephemeralness of time; adulthood, a low-hanging fruit now.
Finally at DebConf 9
After a random series of hazardous events, I'm finally at DebConf 9 in Cáceres, Spain. I'll post more updates later, right now I'm trying to put my sh*t together and find my way through around here for the next couple of weeks. Interested people can always follow my microblogging feed too.
Love, D.
Sync your Twitter followers and friends
I have a couple of accounts in Twitter (namely @debian and @planetalinux) that are starting to bring a lot of followers (well, at least some of them). And given that I consider these accounts to be Twitter-polite enough, I like to follow the followers back too; however, this task sometimes gets really hard and it's tiring to go through the followers pages and follow those that I don't follow yet over and over.
So, I spent a few minutes and came up with this simple Ruby script that uses John Nunemaker's awesome Twitter gem.
#!/opt/local/bin/ruby
require "rubygems"
require "twitter"
httpauth = Twitter::HTTPAuth.new(
ARGV[0] || 'yehyeh',
ARGV[1] || 'kissm3'
)
base = Twitter::Base.new(httpauth)
i = 0
(base.follower_ids - base.friend_ids).each do |id|
i += 1
begin
base.friendship_create id
rescue Twitter::General => e
puts "#{e.class}: #{e.message}"
end
end
puts "#{i} new friendships."
i = 0
(base.friend_ids - base.follower_ids).each do |id|
i += 1
base.friendship_destroy id
end
puts "#{i} destroyed friendships."
puts "#{base.friend_ids.size} friends now."
puts "#{base.follower_ids.size} followers now."
What this little code does is exactly that, it will start following the followers you don't follow yet, and it will stop following the people that don't follow you back, right? Got it? It's basically synchronizing your friends with your followers. As said, this is particularly helpful when you are maintaining a community account and want to keep up befriending your kind followers
Handling the exception Twitter::General on line 18 is only done because the twitter gem raises it even when you are trying to befriend an account to which you have already requested friendship (like pending requests to protected updates accounts) or those of suspended accounts (spammers).
Cheating the world you tweet less
The number of updates on my Twitter page kind of bothers me sometimes. It's a reminder of the amount of time I've spent and wasted on Twitter, it's an ever-itching mole in front of my face. However, I can cheat the system and society and still feel good about myself. What if I just remove all freaking replies I've made, except for those of people I do care about (like my fiance or Ruby Boobie)? And also, I don't want to remove very recent replies.
Well, let's just do it already.
#!/opt/local/bin/perl
use Modern::Perl;
use Net::Twitter;
use DateTime::Format::DateParse;
use DateTime;
binmode STDOUT, ":utf8";
my $t = Net::Twitter->new(
user => shift @ARGV || 'lazy_fuck',
password => shift @ARGV || 'bl0wm3');
my $whitelist = [qw/maggit rubx axiombox/];
my $then = DateTime->now;
$then->subtract(days => 5);
my $x = 1;
for my $i (1..80) {
my $tweets = $t->user_timeline({ page => $i, count => 200 })
or die "No fish for you, loser.\n";
for my $h (@$tweets) {
next unless $h->{"in_reply_to_screen_name"};
next if grep { $_ eq $h->{"in_reply_to_screen_name"} } @$whitelist;
my $date = DateTime::Format::DateParse->parse_datetime($h->{"created_at"});
next unless $date < $then;
say $x, ": (", $h->{"id"}, ") ", $h->{"text"};
$t->destroy_status($h->{"id"});
$x++;
}
}
This little fucker will try to fetch your latest 16'000 tweets (if you have… twat, *grin*, more than that, you've got real issues and I cannot help there, get a shrink or something).
It'll make 80 requests for your timeline (remember Twitter gives you a 100-request hour limit), so only if the reply doesn't come from a certain people AND the reply is older than a given period of time (I'm setting it to one week for me), it'll get rid of it. If a friend doesn't see the reply in a week, she probably never will. After that, it just destroys the tweet (or it tries at least, from my experience, Twitter is still experimenting a hell lot of issues on their service).
That way you can cheat the system removing useless tweets that no one (not even you or the recipient) cares about anymore. Or just… don't give a shit, and you are all set too.
The first time I ran it, I went from like 6k tweets to 2500, which was a nice drop
. If you feel like it, just grab it and customize to fit your needs. You will be needing the CPAN modules Modern::Perl, DateTime, DateTime::Format::DateParse and of course, Net::Twitter.
@debianproject is now @debian!
Thanks to Jamie, who used to have the name registered and now handed it over, Twitter Debian's Twitter username is now @debian (go follow Jamie now!). If you were already following @debianproject, nothing will change.
Having @debian on Twitter is actually kind of awesome!
Debian Maintainers now able to post to Debian Twitter
I've added support for Debian Maintainers to post tweets to Debian Twitter (both on Identi.ca and Twitter). Feel free to use it.
Twitter's OAuth + Perl
During the last week, unbeatable Tatsuhiko Miyagawa uploaded Net::Twitter::OAuth to CPAN, which provides an awesome interface for Net::OAuth::Simple and Twitter by subclassing Net::Twitter. This way, it's very easy to develop Twitter client applications using its new OAuth method dropping the need for users to hand their credentials to third parties.
You will have to register your application on Twitter previously. You can do so here. If this is a web application that you will be building, you can provide a callback URL which is the page where the user will get redirected once she has granted access to your application. If you just want to test, setting a desktop application is probably the way to go.
Once you have registered your application, you will get two strings, key and secret consumer. Refer to general OAuth documentation for deeper details.
Install Net::Twitter::OAuth as any other Perl module:
$ sudo cpan Net::Twitter::OAuth
Now, using it is very simple:
my $client = Net::Twitter::OAuth->new( consumer_key => "YOUR-CONSUMER-KEY", consumer_secret => "YOUR-CONSUMER-SECRET", );
No transactions or requests have been made yet. Here you need the user's access and secret tokens. If you already have them, which means that the user has already gone through the authorization process, you have to pass it now (you already stored them on database, a configuration file or whatever the data model you use):
if ($access_token && $access_token_secret) {
$client->oauth->access_token($access_token);
$client->oauth->access_token_secret($access_token_secret);
}
Now you can query Twitter so it can provide you access:
unless ($client->oauth->authorized) {
# The client is not yet authorized: Do it now
print "Authorize this app at ", $client->oauth->get_authorization_url, " and hit RET\n";
<STDIN>; # wait for input
my($access_token, $access_token_secret) = $client->oauth->request_access_token;
save_tokens($access_token, $access_token_secret); # if necessary
}
All these snippets come from the example's of Net::Twitter::OAuth. So basically, if you are not authorized, which means that either the user hasn't even been prompted for authorization or denied access before, then you get the authorization URL which you can give to the user to visit.
Once the user has granted access, you can call request_access_token which will return the user's tokens. Here's where you can save those tokens for future use.
After that block, you are pretty much done and can use the regular Net::Twitter methods:
my $res = $client->update({ status => 'me ownz oauth!!1' });
Soon, a real life application post using HTTP::Engine, KiokuDB and Net::Twitter::OAuth.
Perl in the Time of Social Networks
This is going to be a fantastic and exciting Perl summer.
During the last week, I received notification that the talk I've proposed for both YAPC::NA and YAPC::EU was accepted.
I will be talking about Perl in the Time of Social Networks, which is mainly two broad things: how Perl can actively power a modern social networking site (I'll be releasing a free -as in speech- social network website, similar to Lovd or RailSpace, built with pure Catalyst); and about high-load applications dealing with social networks' APIs and users (a Moose-based universal social network distributor), with Twitter, Facebook, MySpace, Blogger, LastFM, and others. My current contractor has been sponsoring the development and research for this since almost two years now, and we believe it's ready to go public: there's a lot of work backing us up.
I'll be presenting the talk in Pittsburgh, PA, on June 23rd at YAPC|10. If you are around the area, come and attend the talk!
On YAPC::EU::2009, I will be presenting in Lisbon, Portugal, on August 4th, which is conveniently placed just after DebConf 9, which will happen in Cáceres, Spain the week before (I will also be there).
On Twitter alerts and regular expressions
I don't know if I'm the only one that does something like this, but I certainly trust I'm not alone.
I love regular expressions (to which some people say there's nothing regular about) and I just found TweetBeep recently, which is a simple alerts system. There's nothing really new or innovative about it, given that you can get the results yourself using advanced search on Twitter and consuming the results from a feed. However, I for sure, I don't want to spend time setting any of that up, and they do that quite easily, which is the whole difference, ease of use. You can get the results on time intervals via mail. Rocks.
So, one of my alerts is about regular expressions: I'm receiving everything Twitter tweets about them, whether regex, regexp, regexes, regexps, etc. are mentioned, I get them. Now, I feel a bit nerdish/dorky about it given that I like to reply on those tweets on totally random people and try help them whenever it's possible (or just learn a bit more from other regex gurus), but what the hell.
Now, the good thing about this is that being a "good person" and fellow regex buddy with people is starting to pay off. Whether I'm getting new very interesting followers, I also found a nice opportunities niche to take advantage of, and a couple of gigs have come up. I worship building strong relationships with people (as in long-term clients), and when starting to get to know some persons via a common interesting thing such as a regular expressions is just awesome, little piece of awesomeness.
For the geeky part of this post, if my regular expression Twitter alert had to be written as a regex, this would be it:
/regex(?:(ps?|es))?/
The questions now is, should I start following /regular\s*expres{1,2}ions?/ too? Maybe I will



