This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys,os | |
# Defaults | |
SCREEN_WIDTH=300 | |
SCREEN_HEIGHT=300 | |
if sys.platform == "win32": | |
# Windows sucks, but has an API | |
from win32api import GetSystemMetrics |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rede de Casa: | |
Router NetGear (ZON) | |
- Rede wireless (Phantasien) | |
- Macbook (Atreyu) | |
- Router Fonera | |
--- Rede wireless (IvoryTower) | |
------ Desktop (Bastian) | |
------ Disco Externo (Falkor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ReverseDict(object): | |
""" Creates a reverse dictionary, and keeps the connection. Only key access works. """ | |
def __init__(self,dic): | |
self.dic = dic | |
def __getitem__(self,p): | |
for k in self.dic: | |
if self.dic[k] == p: | |
return k | |
# here we have a simple dictionary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT tasks_after_deadline, tasks_open, tasks_after_deadline/tasks_open as ratio | |
FROM ( | |
SELECT COUNT( * ) as tasks_after_deadline | |
FROM `gestor_actionitem` | |
WHERE `due_date` < NOW( ) | |
AND `done` =0 | |
LIMIT 0 , 30 | |
)tab, ( | |
SELECT COUNT( * ) as tasks_open | |
FROM `gestor_actionitem` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# MySQL dump to SQLite generator. | |
# Based on http://stackoverflow.com/questions/489277/script-to-convert-mysql-dump-sql-file-into-format-that-can-be-imported-into-sqlit | |
# Improved by Alcides Fonseca (http://alcidesfonseca.com) | |
if [ "x$1" == "x" ]; then | |
echo "Usage: $0 <dumpname>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prototype extra javascript stuff | |
// http://alcides.ideias3.com | |
Position.GetWindowSize = function(w) { | |
var width, height; | |
w = w ? w : window; | |
this.width = w.innerWidth || (w.document.documentElement.clientWidth || w.document.body.clientWidth); | |
this.height = w.innerHeight || (w.document.documentElement.clientHeight || w.document.body.clientHeight); | |
return this; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I want to build a really simple script to use on Windows. I know | |
nothing about Windows programming. | |
Scenario: | |
I've got a shitty DSL line that doesn't have much bandwidth. | |
I want to prioritise certain applications. I've got some services | |
on my Linux box that I want to turn off when a user on a particular | |
Windows machine is running certain applications. | |
Plan: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io._ | |
import java.net.{URLConnection, URL} | |
import scala.xml._ | |
val username = "alcides" | |
val password = "youwish" | |
val conn = new URL("http://twitter.com/statuses/friends_timeline.xml").openConnection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% if @links != nil %> | |
<% if (@links != nil) && (@links["Link"] != nil) %> | |
<div class="adds"> | |
Sponsored by: | |
<ul> | |
<% for link in @links["Link"] %> | |
<li><%= link["BeforeText"][0] %> <a href="<%= link["URL"][0] %>"><%= link["Text"][0] %></a> <%= link["AfterText"][0] %></li> | |
<% end %> | |
</ul> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: Latin-1 -*- | |
# importações gerais | |
import sys, Tkinter, thread, cgi, webbrowser | |
from os import curdir, sep | |
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer | |
# o programa pode ser chamado com um argumento que será a porta onde irá correr o servidor web. |