Skip to content

Instantly share code, notes, and snippets.

View freyes's full-sized avatar
🥑

Felipe Reyes freyes

🥑
View GitHub Profile
@freyes
freyes / battery.lua
Created May 31, 2012 03:29
Awesome WM batery monitor
-- Modified by Felipe Reyes <freyes@tty.cl>
-- Original: http://awesome.naquadah.org/wiki/Acpitools-based_battery_widget
-- usage:
-- require("battery")
-- include "mybattmon" in your wibox
local naughty = require("naughty")
local time_rem = ""
mybattmon = widget({ type = "textbox", name = "mybattmon", align = "right" })
@freyes
freyes / .emacs
Created November 9, 2012 15:37
Really Simple Emacs Configuration for Begginners
;; to debug the .emacs file
(setq debug-on-error nil)
(setq visible-bell nil)
;; setup the default mode to use
;;Text mode is happier than Fundamental mode ;-)
(setq default-major-mode 'text-mode)
;; define the mail and name
(setq user-mail-address "foo@example.com")
@freyes
freyes / .Xresources
Created November 9, 2012 17:40
my Xresources
urxvt.foreground: grey90
urxvt.cursorColor: #729fcf
urxvt.font: -xos4-terminus-medium-r-normal--14-140-72-72-c-80-iso8859-15
urxvt.scrollBar: False
urxvt.shading: 50
urxvt.transparent: True
urxvt.fade: 80
urxvt.fadeColor: #e9b96e
urxvt.tintColor: #5c5c5c
urxvt*urgentOnBell: true
@freyes
freyes / rds.cfg
Created December 3, 2012 20:35
nagios check rds configuration
# check a RDS with nagios and change the check host command (by default ping)
# to check an open tcp port
define command {
command_name check-rds-host-alive
command_line /usr/lib/nagios/plugins/check_tcp -H $HOSTADDRESS$ -p 3306
}
define host {
use generic-host
@freyes
freyes / jkbox.py
Created January 18, 2013 15:00 — forked from niedbalski/jkbox.py
import zmq
import urlparse
import urllib
import json
DEFAULT_TIMEOUT=5
def parse(link):
url_data = urlparse.urlparse(link)
query = urlparse.parse_qs(url_data.query)
import zmq
import sys
context = zmq.Context()
socket = context.socket(zmq.PUSH)
socket.connect("tcp://172.21.0.49:5000")
socket.send_json({'video': sys.argv[1]})
sys.exit(0)
@freyes
freyes / codereview.py
Created January 31, 2013 20:05
A simple mercurial plugin to prepare a mail template with the diff of a given revision (by default tip) and then the mail is sent via localhost
# one line to give the program's name and an idea of what it does.
# Copyright (C) 2013 Felipe Reyes <freyes@tty.cl>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@freyes
freyes / ctxmgr.py
Created June 27, 2013 22:15
A context to use temporary directory and don't have to 'remember' to delete it
import os
import tempfile
import shutil
from contextlib import contextmanager
@contextmanager
def mkdtemp(*args, **kwargs):
d = tempfile.mkdtemp(*args, **kwargs)
try:
#!/usr/bin/env python
# Jorge Niedbalski <jnr@pyrosome.org>
class Query:
def __init__(self):
(self.c, self.d) = ([],[])
def a(self, d):
self.d.append(d)
@freyes
freyes / os-nova-pause.sh
Last active August 29, 2015 14:05
Pause/unpause all the virtual machines in a OpenStack cloud
#!/bin/bash
#
# Usage:
# ./os-nova-pause.sh pause
#
# Note: remember to define the environment variables used by the openstack clients
# typically this is done sourcing a 'openrc' file (you can download it from horizon)
#
function mod_server {