Skip to content

Instantly share code, notes, and snippets.

View maraca's full-sized avatar

Martin Cozzi maraca

View GitHub Profile
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "json":
In Gemfile:
chef (~> 11.4.4) ruby depends on
json (<= 1.7.7, >= 1.4.4) ruby
strainer (~> 3.0.4) ruby depends on
json (1.8.0)
The command "bundle install" failed. Retrying, 2 of 3.
2013-06-25 00:27 PDT 6.65 feet High Tide
2013-06-25 05:48 PDT Sunrise
2013-06-25 07:36 PDT -1.61 feet Low Tide
2013-06-25 08:36 PDT Moonset
2013-06-25 14:19 PDT 5.25 feet High Tide
2013-06-25 19:44 PDT 2.18 feet Low Tide
2013-06-25 20:51 PDT Sunset
2013-06-25 22:40 PDT Moonrise
2013-06-26 01:20 PDT 6.26 feet High Tide
2013-06-26 05:48 PDT Sunrise
>>> from django.forms.widgets import DateInput
>>> DateInput.format
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: type object 'DateInput' has no attribute 'format'
@maraca
maraca / mysql_sftp_dump.py
Created September 5, 2012 06:32
MySQL dump to SFTP
#!/usr/bin/python
"""
Connects to MySQL, dumps a list of 10 movies, writes them to a CSV file
and upload that file to a SFTP server.
Example:
> ./main.py --ftp_host=localhost --ftp_username=username \
--mysql_host=localhost --mysql_username=delme \
--mysql_db=delme --mysql_password=delme \
--export_file=/tmp/export
@maraca
maraca / kestrel-cli.py
Created April 4, 2012 00:44
Quick and dirty cli for Kestrel queuing system.
#!/usr/bin/python
import logging
import optparse
import sys
import socket
# 3 seconds timeout
_SOCKET_TIMEOUT = 3
class KestrelClient:
@maraca
maraca / gist:1868237
Created February 20, 2012 07:16
binary search
#!/usr/bin/python
def search(number_list, n):
maxi = len(number_list)
mini = 0
pin = len(number_list) / 2
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
Domain Name: FORMVOTE.COM
Registrar: GODADDY.COM, INC.
Whois Server: whois.godaddy.com
A woman in a hot air balloon realized she was lost. She reduced
altitude and spotted a man below. Shee decended a bit more and
shouted: 'Excuse me, can you help me? I promised a friend I would meet
him an hour ago but I dont know where I am.'
The man below replied, 'You are in a hot air ballon hovering
approximately 30 feet above the ground. You are between 40 and 41
degrees North latitude and between 59 and 60 degrees west longtitude.'
'You must be an Engineer,' said the balloonist.
'I am' replied the man, 'How did you know.'
'Well'; answered the balloonist, 'everything you have told me is
@maraca
maraca / main.py
Created October 22, 2011 12:07
Unique QR codes w/ hash of current timestamp
#!/usr/bin/python2.7
__author__ = "cozzi.martin@gmail.com"
import hashlib
import os
import qrcode
import time
def arr_leader(values):
storage = {}
max_sum_key = values[0]
max_sum_val = 1
for i in values:
if storage.get(i) is None:
storage[i] = 0
storage[i] += 1
# stores the current highest sum