Skip to content

Instantly share code, notes, and snippets.

View maraca's full-sized avatar

Martin Cozzi maraca

View GitHub Profile
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
@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
@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 / 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
>>> 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'
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
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.
@maraca
maraca / shell
Last active December 20, 2015 03:39
Hookup Travis-CI build results to HipChat
$ travis encrypt "your_api_key@your_chat_room_name"
Please add the following to your .travis.yml file:
secure: "CG2F0b+/IkSn0RmFE0N9GjTeKw+FSqEMTpUdYTztH+TThKnE/RvlxLJO4Lg9zIWVYT2ma0EgU5jWdMMPj48/T+rWf/rUt2TXpAPiyJJx/y2ywylOiX/EAs="
Pro Tip: You can add it automatically by running with --add.
@maraca
maraca / output
Last active December 20, 2015 04:59
ChefSpec cannot load such file -- rvm
LoadError
---------
cannot load such file -- rvm
Cookbook Trace:
---------------
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/default.rb:25:in `require'
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/default.rb:25:in `from_file'
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/system_install.rb:20:in `from_file'
/home/martin/application-cookbook/vendor/cookbooks/rvm/recipes/system.rb:20:in `from_file'
@maraca
maraca / package.sh
Last active December 25, 2015 11:29
Package Ruby 1.9.3-p448 with FPM
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p448.tar.gz
tar -xzvf ruby-1.9.3-p448.tar.gz
cd ruby-1.9.3-p448/
./configure --prefix=/usr && make && make install DESTDIR=/tmp/ruby-1.9.3
fpm -s dir -t deb -n ruby-1.9.3 -v 1.9.3-p448 \
--description "Self-packaged ruby 1.9.3" \
-C /tmp/ruby-1.9.3 -p ruby-VERSION_ARCH.deb \
-m '[email protected]' --vendor 'Cotap Inc.' \
--license 'Private' \
--url 'https://github.com/cotap' \