Pebbles
My thoughts, my expressions.
Turn Skype into your own Campfire desktop client
Tired of searching a desktop client for Campfire? Especially for Linux? Well, here is a simple solution. Just get pifire and skype4py packages installed on your Linux (mine is Ubuntu 10.10) and with a little python topping from your part, you are ready to go!
The campfire messages will be displayed on your Skype default contact ‘echo123′. You can post a reply back to campfire just by replying to the ‘echo123′ on Skype but by adding a handle ‘@camp’ in the message! Cool eh?
import pyfire
import Skype4Py
skype = Skype4Py.Skype()
skype.Attach()
def incoming(message):
msg = ""
user = ""
if message.user:
user = message.user.name
if message.is_joining():
msg = "\r\n%s ENTERS THE ROOM" % user
elif message.is_leaving():
msg = "\r\n%s LEFT THE ROOM" % user
elif message.is_tweet():
msg = "\r\n%s %s TWEETED '%s' - %s" % (user, message.tweet["user"], message.tweet["tweet"], message.tweet["url"])
elif message.is_text():
msg = "\r\n%s says: %s" % (user, message.body)
elif message.is_upload():
msg = "\r\n%s UPLOADED FILE %s: %s" % (user, message.upload["name"],
message.upload["url"])
elif message.is_topic_change():
msg = "\r\n%s CHANGED TOPIC TO '%s'" % (user, message.body)
skype.CreateChatWith('echo123').SendMessage(msg)
def error(e):
print("Stream STOPPED due to ERROR: %s" % e)
print("Press ENTER to continue")
campfire = pyfire.Campfire("yourdomain.campfirenow.com", "campfireusername", "campfirepass", ssl=True)
room = campfire.get_room_by_name("CampfireRoomName")
room.join()
stream = room.get_stream(error_callback=error)
stream.attach(incoming).start()
def monitor_message(msg, stat):
message = msg.Body
if "@camp" in message and stat == "SENT":
message = message.replace("@camp ", "")
print "Sending to campfire: %s" % message
room.speak(message)
skype.OnMessageStatus = monitor_message
raw_input("Waiting for messages (Press ENTER to finish)\n")
stream.stop().join()
room.leave()
Happy SkypeFire
!
Zend FW + ACL + Doctrine + Minify easy integration
The story goes like this… Suddenly, I had to work on a zend based project with some ORM and Minify toppings and I was looking for some quick and easy start-up in the Internet which finally lead me to do a packing Myself! Here are the demo-able features that Ive used in this starter kit.
- App config via. XML
- Routes config via XML
- Layouts
- Logger
- Multi Page Forms (Wizard Forms)
- ACL
The project is shared on Github and can be downloaded here.
…cheers
Mozilla Thunderbird Minimize to Tray
Tired of searching a Thunderbird minimizer? Don’t worry! Just go to https://addons.mozilla.org/en-US/thunderbird/addon/2110 download the xpi and unzip (xpi is actually a zipped folder) to a temp location, edit the install.rdf, find <em:targetApplication> for Thunderbird, set <em:maxVersion>x.x.x</em:maxVersion> to the desired one. Then again zip the entire folder contents, rename the zip to “.xpi”. Hurray! your are done! Just install this to your Thunderbird.
Google Maps – making your map accessible to api without api key
Days back I was playing around with Google’s maps and I found it quite frustrating that the maps I created with http://maps.google.com/maps/mm is not accessible by APIs unless I authenticate by signing in to my Google account. I was getting a ‘map not api visible’ error. For those who are having similar situation, here is the solution. Use any api (java, php, python or even javascript) to set your map’s ‘api_visible’ property to true!
<script>
function login(){
token = google.accounts.user.login('http://maps.google.com/maps/feeds');
if(token) updateMap();
}
function updateMap() {
//mapUrl is the url to your map - http://maps.google.com/maps/feeds/maps/userID/full/mapID
service.getMapEntry(mapUrl, function(entryRoot) {
var entry = entryRoot.entry;
entry.addCustomProperty({name:'api_visible', value:'1'});
entry.updateEntry(
function(ent){alert('Updated!');},
function(e){alert('Upadte err...' + e);});},
function(e){alert("Err..." + e);}
);
}
</script>
<input onclick="login();" type="button" value="Authenticate!" />
<input onclick="updateMap();" type="button" value="Update!" />
Happy mapping!
Regular expression for stripping off tags from html
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegExp_SandBox {
//Pattern to escape
final static String SCRIPT_PATTERN = "<\\s*script\\s*([^>]*)\\s*>|<\\s*/\\s*script([^>]*)\\s*>";
//Compile pattern
static Pattern scriptPattern = Pattern.compile(SCRIPT_PATTERN, Pattern.CASE_INSENSITIVE);
/**
* @param args
*/
public static void main(String[] args) {
//Source string
String css = "Hello world <p>Not replaced</p> <script id='youfool' name=\"youfool\">Test this</script> <strong>this is strong</strong>";
System.out.println( css + "\n---------------------------------------------" );
//replace all matches
css = matchAndReplace(css, scriptPattern, "*");
System.out.println( css + "\n---------------------------------------------" );
}
public static String matchAndReplace(CharSequence message, final Pattern pattern, final String replace)
{
Matcher matcher = pattern.matcher(message);
StringBuffer buffer = new StringBuffer();
while (matcher.find())
{
matcher.appendReplacement(buffer, replace);
}
matcher.appendTail(buffer);
return buffer.toString();
}
}
Disabling multicast in multi-homed linux servers
Sometimes you will have multiple ip bound to your server’s network adapters. And, by default multicast will be enabled on all the interfaces except for the loop back. This will create troubles while handling applications that are depending multicasting for their working. We need to enable multicasting on only one network interface. I put this in my blog because I found out the solution for clustering problems after a while of research
Steps you need to follow to disable multicast on multihomed servers :
[root@web bin]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:30:48:5B:54:9A
inet addr:10.5.108.84 Bcast:10.5.108.127 Mask:255.255.255.192
inet6 addr: fe80::230:48ff:fe5b:549a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:32349735 errors:0 dropped:0 overruns:0 frame:0
TX packets:27410647 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1607667954 (1.4 GiB) TX bytes:4270795211 (3.9 GiB)
Interrupt:17
eth1 Link encap:Ethernet HWaddr 00:30:48:5B:54:9B
inet addr:75.126.68.198 Bcast:xx.xx.xx.xx Mask:255.255.255.240
inet6 addr: fe80::230:48ff:fe5b:549b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:442117208 errors:0 dropped:0 overruns:0 frame:0
TX packets:471331869 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1831922661 (1.7 GiB) TX bytes:3006291822 (2.7 GiB)
Interrupt:18
eth1:0 Link encap:Ethernet HWaddr 00:30:48:5B:54:9B
inet addr:xx.xx.xx.xx Bcast:xx.xx.xx.xx Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:18
eth1:1 Link encap:Ethernet HWaddr 00:30:48:5B:54:9B
inet addr:75.126.48.157 Bcast:75.126.48.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:18
eth1:2 Link encap:Ethernet HWaddr 00:30:48:5B:54:9B
inet addr:xx.xx.xx.xx Bcast:xx.xx.xx.xx Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:18
eth1:3 Link encap:Ethernet HWaddr 00:30:48:5B:54:9B
inet addr:xx.xx.xx.xx Bcast:xx.xx.xx.xx Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:18
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:2994064 errors:0 dropped:0 overruns:0 frame:0
TX packets:2994064 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2632223784 (2.4 GiB) TX bytes:2632223784 (2.4 GiB)
You can disable multicast on multiple interfaces by the following command :
[root@web bin]# ifconfig eth1 -multicast
Then the ifconfig will look like :
http://www.yolinux.com/TUTORIALS/LinuxTutorialNetworking.html
http://www.penguin-soft.com/penguin/man/8/ifconfig.html
Hi all,
Welcome to http://chozhiyath.wordpress.com/ For a long time it was in my mind to start blogging. Many are taking blogging seriously while a few find it one among their hobbies. Either way, blogs are really great for “con·vey·ance“.
