Skip to content

Instantly share code, notes, and snippets.

View guerrerocarlos's full-sized avatar
:octocat:
On shoulders of giants.

Carlos Guerrero guerrerocarlos

:octocat:
On shoulders of giants.
View GitHub Profile
@guerrerocarlos
guerrerocarlos / wifi-vpn-bridge.sh
Created May 14, 2013 15:13
To enable a computer to act as a wifi gateway in MacOSX
#!/bin/sh
natd -interface tun0
ipfw -f flush
ipfw add divert natd ip from any to any via tun0
ipfw add pass all from any to any
sysctl -w net.inet.ip.forwarding=1
@guerrerocarlos
guerrerocarlos / vpn-internet-sharing
Created May 20, 2013 04:42
Enable VPS internet sharing by VPN
sudo iptables -t nat -F POSTROUTING
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables-save | sudo tee /etc/iptables.sav
iptables-restore < /etc/iptables.sav
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
add to /etc/sysctl.conf:
net.ipv4.ip_forward=1
@guerrerocarlos
guerrerocarlos / gist:5641278
Created May 24, 2013 04:27
Vagrant VM Box Resize
VBoxManage clonehd "source.vmdk" "cloned.vdi" --format vdi
VBoxManage modifyhd "cloned.vdi" --resize 51200
VBoxManage clonehd "cloned.vdi" "resized.vmdk" --format vmdk
from twython import Twython
import tweetstream
import sys
import os
#Credentials needed to access Twitter public Stream
stream_user = "PUT_TWITTER_USER_HERE"
stream_passwd = "PUT_TWITTER_USER_PASSWORD_HERE"
#Keys for Robot to be able to act as a Twitter App
@guerrerocarlos
guerrerocarlos / Aduana.py
Created June 18, 2013 22:55
Aduana del Curso de Python
class Aduana(dict):
def __init__(self,A,B):
self.empleados=10
self.tasa_entrada=A
self.tasa_salida=B
def __init__(self,A,B,C):
self.empleados=C
self.tasa_entrada=A
#!/usr/bin/env python
# example helloworld.py
import pygtk
pygtk.require('2.0')
import gtk
class HelloWorld:
@guerrerocarlos
guerrerocarlos / enviar_tweet_libturpial.py
Last active December 18, 2015 21:29
Ejemplo sencillo de envío de un mensaje utilizando Libturpial. Incluye registro de la cuenta
# -*- coding=utf-8 -*-
from libturpial.api.models.account import Account
from libturpial.api.core import Core
c = Core()
cuenta = "guerrerocarlos-twitter"
mensaje = "Probando desde libturpial"
cuentas_registradas = c.list_accounts()
print "Cuentas registradas: ",cuentas_registradas,"\n"
@guerrerocarlos
guerrerocarlos / gist:6151404
Created August 4, 2013 18:44
Python JSON with Countries and Detailed Venezuelan Geography
# *-* encoding=utf-8 *-*
geo = {
"Dinamarca" : False,
"Tuvalu" : False,
"Bosnia y Herzegovina" : False,
"Tonga" : False,
"Nepal" : False,
"Wallis y Futuna" : False,
"Somalia" : False,
@guerrerocarlos
guerrerocarlos / crm_lead_view.xml
Created August 23, 2013 17:09
Vista que define el campo de busqueda del modulo CRM en openerp 7.0
<!-- CRM Lead Search View -->
<record id="view_crm_case_leads_filter" model="ir.ui.view">
<field name="name">CRM - Leads Search</field>
<field name="model">crm.lead</field>
<field name="arch" type="xml">
<search string="Search Leads">
<field name="name" string="Lead / Customer" filter_domain="['|','|',('partner_name','ilike',self),('email_from','ilike',self),('name','ilike',self)]"/>
<field name="categ_ids" string="Category" filter_domain="[('categ_ids','ilike',self)]"/>
<field name="section_id" context="{'invisible_section': False}"/>
@guerrerocarlos
guerrerocarlos / gist:8015466
Created December 18, 2013 00:40
Enable and Disable MacOSX DNS server (bind/named)
sudo launchctl load /System/Library/LaunchDaemons/org.isc.named.plist
sudo launchctl unload /System/Library/LaunchDaemons/org.isc.named.plist