Updates from March, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • diegor 3:25 pm on September 24, 2011 Permalink | Reply
    Tags:   

    HOWTO: select a specific python package version using easy_install 

    easy_install” installs the latest version available of a python package. Sometime you need to use a specific version and you can install an earlier version of the package you need. For instance, if you need django 1.1.4, you’ll type:

    #> easy_install "django==1.1.4"

    Pretty simple eh?

    Questions, doubts, comments are appreciated :)

     
  • diegor 10:08 pm on September 7, 2011 Permalink | Reply  

    Something is changing 


    Stay tuned!

     
  • diegor 11:40 am on June 13, 2011 Permalink | Reply
    Tags:   

    HOWTO: using telnet to make HTTP request 

    Telnet is an old utility used in local network to offer a bidirectional communication text-oriented using a terminal. Can be used also to make an http call to a remote server with the purpose of testing. Let’s see how:

    1. Open you favorite terminal
    2. Type (instead of diegor.it you can choose whatever server you want)
      #> telnet diegor.it 80

      and you should have as output:

      Trying 75.119.192.123...
      Connected to diegor.it.
      Escape character is '^]'.
    3. Now type:
    4. GET / HTTP/1.1
      host: diegor.it
      <line feed>

      where “/” is the remote path. In this case we want the root. The output looks like this below:

      HTTP/1.1 200 OK
      Date: Mon, 13 Jun 2011 09:06:43 GMT
      Server: Apache
      Cache-Control: no-cache, must-revalidate, max-age=0
      Pragma: no-cache
      Expires: Wed, 11 Jan 1984 05:00:00 GMT
      Last-Modified: Sun, 12 Jun 2011 13:29:48 GMT
      Vary: Accept-Encoding
      Content-Length: 85589
      Content-Type: text/html;charset=UTF-8
      
      ...

    Pretty simple! Any questions or comments are welcome.

     
    • Paolo Bernardi 12:17 pm on June 13, 2011 Permalink | Reply

      Careful there, maybe that MaxOS X telnet is very smart, but usually the command is in the form “telnet hostname port”. So, ‘telnet http://www.diegor.it 80′ is a better way to do this, the protocol is specified by the port number. :-)

      • diegor 12:29 pm on June 13, 2011 Permalink | Reply

        I can’t get what are you saying. Where’s the “error”?

      • diegor 12:32 pm on June 13, 2011 Permalink | Reply

        Ok, now i get it. The problem is that this fucking wordpress put “http://” as prefix in www addresses

  • diegor 3:28 pm on June 12, 2011 Permalink | Reply
    Tags:   

    HOWTO: ignore requests without user agent in Apache 

    A public web server could be reached by many http requests with no user agent. Apache can avoid this kind of requests. The configuration is very straightforward:

    <Directory /path/to/a/directory>
        SetEnvIfNoCase User-Agent "^-?$" noUserAgent
        Order Allow,Deny
        Allow from All
        Deny from env=noUserAgent
    </Directory>

    In this example Apache ignores all requests without user agent that are directed to /path/to/a/directory

    Any comments are appreciate.

     
  • diegor 9:45 am on May 20, 2011 Permalink | Reply
    Tags:   

    HOWTO: “ip_conntrack: table full, dropping packet” 

    I used to manage a server based on linux and once I had this strange message:

    #> ip_conntrack: table full, dropping packet

    One of the effects of this message is that you aren’t able to make and receive new connections.
    To solve that is enough increase ip_conntrack_max value. As first step check the current value typing:

    #> cat /proc/sys/net/ipv4/ip_conntrack_max
    65536

    Now, increase this value typing:

    #> echo 131072 > /proc/sys/net/ipv4/ip_conntrack_max

    Generally the right value of ip_conntrack_max is set to the total MB of RAM multiplied by 16. If you have 8GB RAM (8192 MB), the value should be 131072.

     
  • diegor 7:58 pm on March 4, 2011 Permalink | Reply
    Tags:   

    HOWTO: run cron job in seconds 

    If you know what cron is, you also know that the minimum time to execute a job is a minute. There is a small tip to execute a cron job every X seconds. For example if you need to run a cron job every 30 seconds (it’s a common case), you can do it adding these lines to crontab:

    * * * * * root sh /path/to/myscript.sh
    * * * * * root sleep 30 && sh /path/to/myscript.sh

    Both lines execute the job every minute, but the second one waits 30 seconds using “sleep” command from bash.

    If you have any question, comment this post. :)

     
    • Andrea 4:01 pm on July 24, 2011 Permalink | Reply

      Very nice guide! It’s very tricky. Anyway do you know some implementation of a scheduler such cron that deals with seconds instead of minutes?

    • diegor 11:17 pm on July 24, 2011 Permalink | Reply

      Mmm, sorry I don’t know any scheduler except cron..

c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel

Switch to our mobile site

Powered by Google Talk Widget