Browsing the archives for the client tag.

Create simple twitter bot using python

Internet, Tutorial

In this tutorial you will learn how to do very simple twitter bot. Requirements is Linux/Mac system, but it should be possible to get this on windows.

Install python-twitter

First, you need to install python-twitter package. Installion is simple. Just download package from python-twitter’s website and follow instructions.

Lets get started

In this code we import libraries needed to get this working. First library is the twitter-python package and another is time-library for creating simple timer. We need timer for doing a loop. Commands library is needed to get output from external command. (In this case, uptime)

#!/usr/bin/python
import twitter
import time
import commands

Intializing api


api = twitter.Api(username='username', password='password')

This will intialize twitter api and create new class, api. Change username and password to your accounts details.

Tweeting something


while 1 == 1:
api.PostUpdate(getoutput('uptime'))
print(getoutput('uptime'))
time.sleep(3600)

This will generate infinite loop that will send twitter update every hour. Tweet contains output of uptime command. This also prints output to console so its easier to see what is tweeted.

I run this command inside screen, so it will run 24/7 tweeting uptime of my vps.

If you want to learn more about python-twitter I recommend to read docs on python-twitters website.

Download source code of this tutorial: twitter_bot.py

No Comments

Twitterrific ipod touch/iphone update

Applications, Internet, Mac, iPod touch/iPhone apps

Some time ago Iconfactory published new version of twitterrific for iPod touch/iPhone. The change log didn’t even show every change when I update this with app store, so I didn’t even notice that there was totally recreated version out. Now twitterrific is my first choice for mobile twitter client!

So… What’s new?

  • The application looks different and there is more blue birds. :P you can switch from 3 different tweet viewals tos another with one button. One “normal” view, one with extra large icons and one without icons.
  • Now there is support for multitiple accounts and this app will also include search and trends at statup page.
  • Action menu! After tapping a tweet you can open action menu. From action menu you can open someones profile view (where you can follow them and see their profile, followers/following count and so on.) You can also retweet from action menu.
  • Best thing is that posting new tweets is even better. It looks nice, but it is also easier to change from dm/reply/normal to another.
  • Show threads. Nice feature that makes your life easier of you have conversation with someone.
  • The build in browser have also got some new features. Best that I really like, is ability to save bookmark to delicious.
  • Twitterrific is awesome mobile app. I hope that they will update the desktop version soon.

No Comments

Ultimate Irssi guide for beginners

Applications, Tutorial

What is irssi?

Irssi is modern command-line irc client. It is very customizable, stable and fast irc client. Best thing about irssi is that you can run it on shell account inside screen, so you will be online 24/7 even if you shut down your computer. You can connect to your irc from any machine you have. You can use your client from any machine.

Irssi may be little difficult at first, but after learning it, it becomes extremely powerful irc-client.

Basics settings

Installing irssi is easy, just use your distros package-manager. I also recommend to install” screen”. You can find it also from standart repos.

Start irssi with “irssi” in terminal. You should found very basic screen with first time message.

Lets set up some basic settings and connect to irc network. Type “/set timestamp_format %H:%M:%S” That gives seconds to timestamps. (normally it is just %H:%M) Then lets set nick and other name stuff, “/set nick asdasdasd” will change your default nick before connecting. After connection , use “/nick asdasd” instead.

Then type “/set name” name is not a option to set, but irssi will show you all settings that have a “name” on it. Very easy to search for settings. Also all settings supports tab completion, so you can type “/set user_n<tab>”. You can also use <tab> on nicks and commands.

Connecting to servers

Connecting to server is easy. Just “/connect irc.freenode.net” Then, when you have connected just type “/join #channelname” to join channel. Then just start chatting :) . You can leave channel with “/leave” or “/part” command.

Connecting to multiple servers is also easy. Just type another “/connect irc.servername.org”. Using “/server” you can list servers. In default status window (alt+1) you can change server where commands are going by <ctrl>+x. Example if you want to join another channel, press <ctrl>+x to get right server and then just give join command.

Window managing

Window managing may feel weird at first. After you have connected and joined to couple channels, you can change window with <alt>+windownumber or using <ctrl>+n/p. First window (1) is the status window where all server stuff and irssi’s system messages goes. Other windows are mostly for channels and querys

You can change position of windows using “/window move left” (or right) command. There is also way to split windows and make them sticky. Use “/help window” to read more.

Tip: If you have over 10 windows open, you can open windows 11,12,13… with <alt>+q,w,e…

Alias

Aliases are easy and powerful way to create simple commands and make long commands shorter. Syntax for aliases is simply. “/alias longline say This is a freaking long line that you must type many times on day” After that you can use “/longline” to say that line to channel.

you can also create aliases for irssi commands, like “/alias wml window move left”. Then you can move window to left with “/wml”

You can list aliases with “/alias”. Removing aliases is done vie “/unalias”

It is also possible to create aliases with parameters. “/alias slap me slaps % around with a large trout.” Then just “/slap <nick>”!

A uptime alias is also very fun. It shows uptime of Irssi, not system.  Some versions/packages of irssi has this alias already, but if you don’t have “/uptime” command, create it with: “/alias uptime eval exec – expr `date +%s` – $F | awk ‘{print “Irssi uptime: “int(\$1/3600/24)”d “int(\$1/3600%24)”h “int(\$1/60%60)”m “int(\$1%60)”s” }’”

My best uptimes for irssi is about 60-70 days.

Screen

Screen, way to keep your irssi alive. Screen is program that allows dedacthing cli-programs and then continuing them using them later. Start irssi with “screen irssi”, then when stopping chatting just type <ctrl>+a <ctrl>+d and irssi is detached! To retacth irssi use screen -r command.

This is useful when you run your irssi on machine that is running 24/7, a shell. For free shells try #bshellz@freenode. They offer best free shells.

To get bell working, first set screen to support audible bell. (<ctrl>+a <ctrl>+g) Then set irssi “/set beep_msg_level hilight” or what ever level you want. (/help levels)

Scripts and themes

Scripts are powerful way to add new features to irssi. You can find scripts from http://irssi.scripts.org.

Installing scripts is pretty simple. Just “cd” to “.irssi”  and create script directory if it doesn’t exist. “mkdir scripts” and then wget script.Eexample “wget http://url.to.script.file”.

After download, run script using “/run scriptname” or “/script load scriptname”. Unloading scripts is done via “/script unload scriptname”. (/run is alias for loading scripts). Listing running scripts is easy. Just type “/script”.

Themes are also easy to install, just put the .theme file to .irssi folder, then “/set theme <themename”.

Scripts I recommend to try:

  • awl.pl – Listing windows on statusbar, excellent script and very customizable
  • lastfm.pl – Now playing script using last.fm
  • autoaway.pl – Automatically set you away
  • keepnick.pl – Keeps your nick and tries to get it back if someone stoles it
  • trackbar.pl – Adds xchat like trackbar to channels so you can easily see what messages are new
  • trigger.pl – Create triggers and other cool tricks
Telnetting to batmud using irssi

Telnetting to batmud using irssi

Irssi with weed theme and awl script

Irssi with weed theme and awl script

8 Comments