September-October

November 17th, 2010 1 comment

September-October

#!/bin/sh
echo $RANDOM  #AGAIN

Events I went in this two months:

  • SuperHappyDevHouse40
  • HackerHouse
  • MozillaLabs Night


  • Mockups and Wireframes

    Mockingbird
    Pencil Project

    Camping Weekend







    Sometimes phpmyadmin is heavy use phpminiadmin


    Facebook scrapping


    NSLU2 with Linux and wireless working at boot time

    http://www.nslu2-linux.org/

    mi wireless usb device:

    /etc/modules:

    # /etc/modules: kernel modules to load at boot time.
    #
    # This file contains the names of kernel modules that should be loaded
    # at boot time, one per line. Lines beginning with "#" are ignored.
    # Parameters can be specified after the module name.
     
    rt2500usb

    check my /etc/network/intefaces:

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
     
    # The loopback network interface
    auto lo
    iface lo inet loopback
     
    # The primary network interface
    allow-hotplug eth0
    iface eth0 inet dhcp
     
    allow-hotplug wlan0
    iface wlan0 inet dhcp
      wireless-essid 2WIRE666
      wireless-key 6660000666

    Craigslist Alpha Posting Script
    (not work until you change some lines and use recaptcha tokens)

    Download cl-posting.pl

    Only is possible using one recaptcha token so needs manual ad/ads the recaptcha fields

    recaptcha uses:

    • recaptcha_challenge_field
    • recaptcha_response_field

    recaptcha_token.pl:

    #!/usr/bin/perl
    use LWP::Simple;
    use POSIX;
    $token = get ("http://www.google.com/recaptcha/api/reload?c=03AHJ_Vut0aY6_HF3az5sw6UwKgqfvQKdVoTMJMXGXpe0OrsAx-29QFWCUSxuFSTs-_bW7HQ8tQIRe0YEez-usbroXYjU8mAkHxkQjUTZMIrTW3HCtR4ABfEXix6T1OqOXZ8d87X7cdSJIDeEwTiRDb3Ey9m7o_OcUQw&k=6Ld4iQsAAAAAAM3nfX_K0vXaUudl2Gk0lpTF3REf&reason=r&type=image&lang=en");
    $token =~ s/(Recaptcha.finish_reload\(\'|\'.*;)//g;
    $url = "http://www.google.com/recaptcha/api/image?c=$token";
    my $status = getstore($url, $token.".jpeg");

    Get recaptcha tokens:

    #!/bin/bash
    while [ 1 ]
    do
        perl recaptcha_token.pl
        sleep 2;
    done

    Clonezilla is amazing 4 full backup hard disk (clonezilla in usb needs 200MB) is very useful I made laptops backups with this baby.

    Projects:

    What uses Craigseed ?

    there are more but not completed or not useful maybe the next month post more info for other projects

    #!Hackgust -w

    September 3rd, 2010 3 comments

    #!Hackgust -w

    # RANDOM STUFF
    echo $RANDOM

    Yep now I can save a life:


    I have network problems almost all this month
    Script to login wireless network in Martin Luther King Jr Public Library:

    #!/bin/bash
    # use your card number and pin, but not work this anymore
    #card=____________ # your number card
    #pass=____________ # your password
    #curl -k -d "user=$card&password=$pass&cmd=authenticate&Login=Log+In" \
    #"https://securelogin.arubanetworks.com/cgi-bin/login" > /dev/null
     
    # Now all wireless access use this account:
    curl -k -d "user=mlkjr&password=library&cmd=authenticate&Login=Log+In" \
    "https://securelogin.arubanetworks.com/cgi-bin/login" > /dev/null

    I use the public library wireless to access Skype but the port was blocked, no problem use a proxy

    My .bash_aliases are something like this:

    alias proxy1='ssh -C -D $PORT -fN $user1@domain1' # -C compress slow connection
    alias proxy2='ssh -D $PORT -fN $user3@domain3' 
    alias proxyn='ssh -D $PORT -fN $user3@domain2'
    # using amazon ec2 ?
    alias proxyamazon='cd ~/.ec2; ssh -D $PORT -fN -i $USER.pem $USER@$AMAZON_SERVER'

    Proxy tools tsocks and proxychains

    sudo apt-get install tsocks proxychains

    I have problems with tsocks for GUI applications so I use proxychains for Opera and Skype:
    My proxychains.conf:

    strict_chain
    proxy_dns
    tcp_read_time_out 15000
    tcp_connect_time_out 8000
    [ProxyList]
    socks5 127.0.0.1 $PORT

    Run many firefox profiles with diff (proxy, addons, etc):

    #!/bin/sh
    firefox -P $1 --no-remote &

    Use Google Chrome with this extensions:

    Read about CSS frameworks:


    Using recaptchalib on PHP

    <?php
    // Hide e-mail using recaptchalib
    require_once('recaptchalib.php');
     
    // return link (click popup to recaptcha)
    function hide_mail($mail) {
        $mailhide_pubkey='____'; // your public key
        $mailhide_privkey='____'; // your private key
        $mail_url =  recaptcha_mailhide_url ($mailhide_pubkey, $mailhide_privkey, $mail);
        return "<a href=\"$mail_url\" onclick=\"window.open('$mail_url', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">e-mail</a>";
    }
    ?>

    I use Python to improve the speed I put my eye and use this modules: thread, multiprocessing

    I check this projects too (asynchronous io):

    Howto export txt to doc and pdf (using python and openoffice):

    #!/bin/bash
    # convert resume.txt resume.pdf # very bad quality (ImageMagick)
    soffice -accept="socket,port=8100;urp;" # for remote access
    python DocumentConverter.py resume.txt resume.doc # Word Document
    python DocumentConverter.py resume.doc resume.pdf # PDF Document

    Download PyODConverter


    I Use Perl:

    How to try and catch on Perl (Handling exceptions):

    # Error handling on Perl:
    eval {
        # your perl code here
    };
    if ($@) {
        print "Error: "$@;
    }

    Perl is amazing for regular expressions a simple example XML file to CSV:

    #!/bin/sh
    curl -o "feed.xml" "http://albertux.ayalasoft.net/feed/"
    perl -ne  'if (/<title>(.*)</) {print $1}
        elsif (/<link>(.*)</) {print ",$1"}
        elsif (/<pubDate>(.*)</) {print ",$1\n"}' "feed.xml"

    NoSQL

    Read about NoSQL and check this projects:

    Only play with CouchDB and MongoDB on my notebook.


    Personal Web projects:

    Screens:


    I will finish this two on this month (that the plan)


    Post Youtube videos on facebook using fbcmd:

    #!/bin/bash
    # HOWTO: ./script.sh "text" "url"
    fbcmd post flash "$1" "http://www.youtube.com/v/${2#*=}" \
    "http://img.youtube.com/vi/${2#*=}/0.jpg"

    Thanks Mom for this pillow:


    My Grandpa, Mother and Uncle on the Skydeck Chicago:

    The last two pics with long hair:

    apt-get remove long-hair

    and now:



    For the next month I’m ready.

    #include "spanish.h"

    Se me olvido mandar saludos a toda la banda en especial a los que ya son papas un saludo a Hector y a Hector Jr, un Saludo a Tere y a Sara su baby, un saludo a toda la banda de MTY pro (Ron, Ortiz Antonio, Texky, Saul (El Unhappy), Alberto Jorge (El champi), la banda del SITE de FIME (Dante, Moy, Felipe), a toda la banda ex Sinemed, a toda la banda ex DGI o DGI (Joaquin el big boss, Joel, a los dos Javieres Rene, Ofelia, Alberto, Jaquelin, Zaira) y a la raza de Softtek (Angel Tomas, Alfredo Pedraza), a la raza del Hacker Room Mx (Hugo, Cesar Salasar, DFectuoso)

    SI se me olvida alguien porfavor perdonenme no lo hago a proposito

    No e tomado video por que mi camara no funciona (las fotos fueron tomadas con el celular)

    Categories: personal Tags: , , , , ,

    Firts Week August

    August 8th, 2010 3 comments

    First Week August

    I know the last month was fucking lazy, but August I think is different, the first week:


    CentOS 5.5 setup on VirtualBox with LAMP

    Download the netinstall ISO from mirrors:
    - CentOS-5.5-i386-netinstall.iso
    - CentOS-5.5-x86_64-netinstall.iso

    [HTTP Setup]
    Website name: mirror.centos.org
    CentOS Directory: centos/5.5/os/i386

    After many screens select only server

    Set up LAMP on CentOS 5.5 Server:

    yum install mysql-server # mysql server
    yum install php-mysql # php with mysql
    /etc/init.d/mysqld start # start mysql (password empty)
    # put mysqld and httpd in run levels
    chkconfig mysqld --level 2345 on
    chkconfig httpd --level 2345 on # httpd is all ready

    If you want to start CentOS on background:

    # Port forward SSH to 2222 localhost:
    VBoxManage modifyvm "CentOS" --natpf1 "guestsssh,tcp,,2222,,22"
    # Port forward HTTP to 8080 localhost:
    VBoxManage modifyvm "CentOS" --natpf1 "guestshttp,tcp,,8080,,80"
    # bash aliases
    alias start_centos='VBoxManage startvm "CentOS" --type headless'
    alias centos='ssh -p 2222 root@localhost'

    Make twitter useful:

    #  goto http://code.google.com/p/python-twitter/ on ubuntu:
    apt-get install python-twitter
    #!/usr/bin/env python
    # -*- coding: UTF-8 -*-
    # Albertux (Alberto Isaac Ayala Esquivias)
    import re, twitter
    import subprocess
    ####################
    # TWITTER  ACCOUNT #
    username='_________'
    password='_________'
    ####################
    ####################
    # EXECUTE COMMANDS #
    start = ["command","param1","param2"]
    stop = ["command","param1","param2"]
    ####################
    ####################
    api = twitter.Api(username, password)
    statuses = api.GetUserTimeline(USER_YOU_FOLLOW)
    msgs = [s.text for s in statuses]
    last_msg = msgs[0]
    flag = re.findall(r"REGEX",last_msg,re.I)
    if len(flag) > 0:
        subprocess.call(stop)
    else:
        subprocess.call(start)

    using bash:

     watch -n 60 ./twitter_check

    3taps heartbeater (latency of post):


    Myself:




    Dr Martin Luther King Jr Pics:


    Hackerdojo pics:





    Random pics:
    P0rn knowledge:

    Damn I lost this pin of #hackerdojo :’(


    Personal projects:

    w@nder July

    August 1st, 2010 2 comments

    wander July – wonder July

    #include "family.h"

    This month was good.


    Some days I go to #hackerdojo on Mountain View


    A simple tweet script using python-twitter

    #!/usr/bin/env python
    import twitter, sys
    api = twitter.Api(USERNAME, PASSWORD)
    if (len(sys.argv) < 2):
        sys.exit()
    tweet = sys.argv[1]
    status = api.PostUpdate(tweet[0:140])
    print status.text

    howto use:

    ./tweet "tweet from command line"

    qTranslate 2.5.8 works good on WordPress 3.0.1, edit qtranslate.php:

    // only replace the next line:
    define('QT_SUPPORTED_WP_VERSION', '3.0');
    // for this:
    define('QT_SUPPORTED_WP_VERSION', '3.0.1');

    time command (stderr) on bash maybe cause problems you need to use the full path or use another shell (using ubuntu lucid lynx):

    #!/bin/bash
    time -o output.log $CMD # -o: command not found, using /bin/dash works
    /usr/bin/time -o output.log $CMD # works
    /usr/bin/time $CMD 2> output.log # works

    Yep I have the driver license (from DMV not Tropicana):


    family/friends this photos are chronologically:






    3taps
    Now I’m using Amazon EC2 to handle the information and scripts I have for www.3taps.com


    Many moves/changes in this month, some projects in my head. (the next week maybe running one of them)


    TODO 4 August:

    • Make and follow a schedule
    • Start up www.ayalasoft.net
    • Cut my hair (maybe)
    • Get a car (I hope so)
    • Make a blueprint for world domination
    Categories: personal Tags:

    Switch DNS

    July 1st, 2010 No comments
    #!/bin/bash
    # Author: Albertux (Alberto Isaac Ayala Esquivias)
    # Script: switch the nameservers (DNS)
     
    if [ ! $( id -u ) -eq 0 ]
    then
    	echo "Run this script as root"
    	exit
    fi
     
    if [ $# -le 0 ]
    then
    	echo "Usage $0 [open|google|comodo|old]"
    fi
     
    if  [ ! -f /etc/resolv.conf.bak ]
    then
    	cp /etc/resolv.conf /etc/resolv.conf.bak
    fi
     
    case $1 in
    	open)
    		echo -e "# OpenDNS\nnameserver 208.67.222.222\nnameserver 208.67.220.220" > /etc/resolv.conf
    	;;
    	google)
    		echo -e "# Google Public DNS\nnameserver 8.8.8.8\nnameserver 8.8.4.4" > /etc/resolv.conf
    	;;
    	comodo)
    		echo -e "# Comodo Secure DNS\nnameserver 156.154.70.22\nnameserver 156.154.71.22" > /etc/resolv.conf
    	;;
    	old)
    		cp /etc/resolv.conf.bak /etc/resolv.conf
    	;;
    esac
    Categories: network, unix/linux Tags: ,