Skip to content

Instantly share code, notes, and snippets.

View snahor's full-sized avatar

Hans Roman snahor

  • Wakanda
View GitHub Profile
# Including logging
log_file = who_args.pop('log_file', None)
if log_file is not None:
if log_file.lower() == 'stdout':
log_stream = sys.stdout
elif log_file.lower() == 'stderr':
log_stream = sys.stderr
else:
log_stream = open(log_file, 'wb')
who_args['log_stream'] = log_stream
@snahor
snahor / gist:410290
Created May 22, 2010 19:19
google pacman
google.pacman ||
function () {
var a = true,
e = false,
g = {},
i = [1, 4, 2, 8],
l = {
0: {
axis: 0,
increment: 0
-- SQL Server
SELECT [Tables] = so.name,
[Rows] = MAX(si.rows)
FROM sysobjects so,
sysindexes si
WHERE so.xtype = 'U'
AND si.id = OBJECT_ID(so.name)
GROUP BY so.name
ORDER BY 2 DESC
// Connection String to Excel Workbook
string excelConnectionString = @"Provider=Microsoft
.Jet.OLEDB.4.0;Data Source=Book1.xls;Extended
Properties=""Excel 8.0;HDR=YES;""";
// Create Connection to Excel Workbook
using (OleDbConnection connection =
new OleDbConnection(excelConnectionString))
{
OleDbCommand command = new OleDbCommand
REPLACE(SUBSTRING(ci.dir_cliente,
CHARINDEX('->', ci.dir_cliente),
CHARINDEX('->', ci.dir_cliente)), '-> ' ,'')
#!/usr/bin/env python
#
# A nifty GUI controlling the window controls position
#
# Depends on python-gconf (started from a python-gconf example)
#
# @version 0.1
# @author alex(at)eftimie(dot)ro
#
(function($) {
jQuery.fn.dummyEmailBox = function() {
var domains = [
'gmail.com',
'hotmail.com',
'hotmail.es',
'live.com',
'live.es',
'yahoo.com',
'yahoo.es',
# -*- coding: utf-8 -*-
SI_NO = ((0, u'No'), (1, u'Sí'))
DILUCIONES = (
('1', '1'),
('1:2', '1:2'),
('1:4', '1:4'),
('1:8', '1:8'),
('1:16', '1:16'),
SELECT
(SELECT name
FROM ubigeo u0
WHERE u0.province_code = ubigeo.province_code
AND u0.department_code = ubigeo.department_code LIMIT 1) AS "provincia",
(SELECT name
FROM ubigeo u0
WHERE u0.department_code = ubigeo.department_code LIMIT 1) AS "departamento",
"ubigeo"."id", "ubigeo"."department_code", "ubigeo"."province_code", "ubigeo"."district_code", "ubigeo"."name" FROM "ubigeo" WHERE "ubigeo"."id" = 758
def edad_gestacional_fur(self):
if self.ultima_menstruacion:
# 40 semanas
days = (date.today() - self.ultima_menstruacion).days
return '{0} {1}/7'.format(days / 7, days % 7)
return None
def edad_gestacional_1eco(self):
"""Retorna la edad gestacional segun la primera ecografia."""
if self.primera_ecografia: