Tweetin - Poste tweets pelo terminal
Publicado por Danillo Souza (última atualização em 02/09/2010)
[ Hits: 6.637 ]
Script que te possibilita enviar tweets pelo terminal, oferecendo proteção na hora da digitação da senha (igual a senha do comando 'su' por exemplo).
#!/usr/bin/perl -w
# Author: Danillo Souza
# Email: danillo012@gmail.com
# Version: 0.1
#
# Small quick script to post tweets while working in the terminal
# or for use on systems that do not use graphical user interface (eg servers).
#
# I hope you use and like ;D
use strict;
use Net::Twitter;
use Term::ReadKey;
# get the password
sub get_pass {
my($msg, $tmp) = (shift, '');
print $msg;
ReadMode 'noecho';
$tmp = ReadLine 0; chomp $tmp;
ReadMode 'normal';
print "\n";
return $tmp;
}
sub tweetin {
# catch the username, password and the text f tweet
my($user, $passwd, $tweet) = @_;
# verifications
if ($user !~ /^.{1,15}$/) {die "Invalid username.\n";}
if ($passwd !~ /^.{6,}$/){die "Invalid password.\n";}
if ($tweet !~ /^.+$/) {die "Invalid tweet.\n"}
if ($tweet !~ /^.{1,140}$/){$tweet = substr($tweet, 0, 140);}
# create the twitter object
my $twitter = Net::Twitter->new(
traits => [qw/API::REST/],
username => $user,
password => $passwd
);
# try to tweet it
eval {$twitter->update($tweet)}; die "Autentication failed.\n" if $@;
# if sucesful..
print "Tweeted at ".scalar(localtime).":\n";
}
# checking the number of parameters
die "Usage: tweetin.pl <user> <tweet>\n" if (scalar(@ARGV) < 2);
# catching command line arguments
my $user = shift(@ARGV);
my $tweet = shift(@ARGV);
my $passwd = get_pass "Password autentication:";
tweetin($user, $passwd, $tweet);
Buscar Traduções no Google Translate
Script para fazer buscas no arquivo de logs do squid
VimeoTheSapo -Baixe videos do Vimeo e do sapo
IPloc - Informações e localização de um determinado endereço IP
Cirurgia para acelerar o openSUSE em HD externo via USB
Void Server como Domain Control
Modo Simples de Baixar e Usar o bash-completion
Monitorando o Preço do Bitcoin ou sua Cripto Favorita em Tempo Real com um Widget Flutuante
[Resolvido] VirtualBox can't enable the AMD-V extension
Como verificar a saúde dos discos no Linux
Como instalar , particionar, formatar e montar um HD adicional no Linux?
Como automatizar sua instalação do Ubuntu para desenvolvimento de software.
Não consigo instalar distro antiga no virtualbox nem direto no hd (8)
Quais os códigos mais dificeis que vcs sabem fazer? (3)
Fiz uma pergunta no fórum mas não consigo localizar (14)
Upscaling com imagem cortada no monitor secundário ao usar iGPU Multi ... (1)
Servidor Ubuntu 24.04 HD 500 não tenho espaço na \home\adminis... [RES... (8)









