Skip to content

Instantly share code, notes, and snippets.

View glarrain's full-sized avatar
🤘
rockin'

Germán Larraín glarrain

🤘
rockin'
View GitHub Profile
#!/usr/bin/env python
# Librerias necesarias
import paramiko
import os
# Datos para la conexion SSH
ssh_servidor = '10.0.70.44'
ssh_usuario = 'tuusuario'
ssh_clave = 'tucontraseña'
# -*- coding: utf-8 -*-
import sys
import time
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
class Screenshot(QWebView):
def __init__(self):
self.app = QApplication(sys.argv)
@glarrain
glarrain / get-ubuntu-installed-packages.sh
Last active September 9, 2015 20:53
Write list of manually installed packaged (and when) in a Ubuntu system by looking in dpkg logs
#!/bin/bash
# source: https://help.ubuntu.com/community/ListInstalledPackagesByDate
#creates text file with a list of all packages installed by date
#first append all info from archived logs
i=2
mycount=$(ls -l /var/log/dpkg.log.*.gz | wc -l)
nlogs=$(( $mycount + 1 ))
@glarrain
glarrain / are-domains-up.sh
Created October 17, 2012 12:42
Test whether each of the domains in the list is up or not
#!/usr/bin/env sh
# Uses curl to connect to www.isup.me, a website that checks if a given domain
# is up or not. The response will contain "It's just you" if the domain is up.
# If not, it will contain "It's not just you".
test $# -lt 1 && (echo "Usage: $0 domain [domain2] [domain3] ..."; exit 1;)
for domain in "$@"; do
echo -n "$domain: "
@glarrain
glarrain / tweets.py
Created October 17, 2012 12:54
Retrieve a user's last tweets
from urllib2 import urlopen
from django.utils.simplejson import loads
from oauth2 import Token
from social_auth.backends.utils import build_consumer_oauth_request
from social_auth.backends.twitter import TwitterAuth
@glarrain
glarrain / MySQL-Chile:regiones-provincias-comunas
Created November 16, 2012 19:49 — forked from juque/MySQL-Chile:regiones-provincias-comunas
Chile: Regiones, Provincias, Comunas
/* Estructura y Datos de las Regiones, Provincias */
/* y Comunas de Chile. */
/* */
/* Fecha: Julio 2010 */
/* Autor: Juan Pablo Aqueveque - juque.cl */
--
-- Comunas
--
DROP TABLE IF EXISTS `comunas`;
@glarrain
glarrain / dump division_chile.json
Created November 19, 2012 22:54
Division politica del territorio de Chile, en formato JSON para modelos creados en Django
[
{
"pk": 6,
"model": "lu_base.region",
"fields": {
"codigo": "15",
"orden_geo": 1,
"nombre_corto": "Arica y Parinacota",
"nombre_largo": ""
}
sudo apt-get install build-essential libsqlite3-dev zlib1g-dev libncurses5-dev libgdbm-dev libbz2-dev libreadline5-dev libssl-dev
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar xz Python-2.7.3.tgz
cd Python-2.7.3
./configure
make
sudo make altinstall
python2.7
@glarrain
glarrain / test_connection.py
Created December 19, 2012 21:38
Remote Redis server
import redis
redis_host = 'ec2-xxx.amazonaws.com'
value = raw_input()
r = redis.StrictRedis(host=redis_host, password=value)
r.set('foo', 'hellooo')
r.get('foo')
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/python");</script>