Skip to content

Instantly share code, notes, and snippets.

View matagus's full-sized avatar
🐿️
I miss the old Github activity stream

Matías Agustín Méndez matagus

🐿️
I miss the old Github activity stream
View GitHub Profile
@matagus
matagus / .bashrc
Created September 15, 2010 19:47
cool bash prompt configuration
MYCOLOR1="\[\033[1;32m\]"
MYCOLOR2="\[\033[1;34m\]"
MYCOLOR3="\[\033[1;37m\]"
MYCOLOR4="\[\033[1;32m\]"
export PS1="$MYCOLOR1\u$MYCOLOR2|$MYCOLOR3\h $MYCOLOR2\w $MYCOLOR4> \[\033[00m\]"
esto en /root/.bashrc:
@matagus
matagus / conf.py
Created October 16, 2010 22:12
django sttings proxy
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _
from django.conf import settings as django_settings
class SettingsProxy(object):
def __init__(self, settings, defaults):
self.settings = settings
self.defaults = defaults
@matagus
matagus / statslogger.py
Created October 29, 2010 02:43
logbook + json + filehandler for django
# -*- coding: utf-8 -*-
import os
from logbook import Logger, TimedRotatingFileHandler
from logbook.queues import ThreadedWrapperHandler
from django.conf import settings
from django.core.serializers.json import simplejson
@matagus
matagus / paginator.html
Created November 5, 2010 01:58
django-haystack paginator
{% if paginator.count %}
<div class="pagination clearfix">
<span class="results-count">{{ paginator.count }} {% trans 'results' %}</span>
<span class="paginator">
{% if page.has_previous %}
<a title="previous page" class="prev awesome medium button"
href="?{{ search_qs }}&amp;page={{ page.previous_page_number }}&amp;{{ form.previous_facets_encoded }}">
&nbsp;
</a>
{% endif %}
@matagus
matagus / supervisord
Created January 10, 2011 12:26
supervisor /etc/init.d script
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
opts="${opts} "
pidfile="/var/run/supervisord/supervisord.pid"
fromcron="0"
# this next comment is important, don't remove it - it has to be somewhere in
# the init script to kill off a warning that doesn't apply to us
@matagus
matagus / do_tweepy.py
Created January 19, 2011 22:31
using tweepy
>>> import tweepy
>>> auth = tweepy.BasicAuthHandler("matagus", "blablabla")
>>> api = tweepy.API(auth)
>>> user = tweepy.api.get_user('twitter')
>>> user
<tweepy.models.User object at 0xb767b88c>
>>> user.id_str
u'783214'
>>> user = tweepy.api.get_user('matagus')
>>> user.id_str
@matagus
matagus / table_to_array.js
Created January 30, 2011 22:10
jQuery table to Array
var data = (function () {
var _data = [];
$("#<TABLE-ID-REPLACE-ME> tbody td").each(
function () {
var rowIndex = this.parentNode.rowIndex -1,
cellValue = this.innerHTML.trim();
if (_data[rowIndex]) {
_data[rowIndex].push(cellValue);
} else {
_data[rowIndex] = [cellValue];
"""
Copyright (c) 2009, Sean Creeley
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
@matagus
matagus / learning.hs
Created June 14, 2011 19:39
Learning Haskell
-- this a single line comment
--
{- and this
- is a multiline
- comment
- in haskell code -}
a = "my string"
b = ['m', 'y', 's', 't', 'i', 'n', 'g']
@matagus
matagus / dict.xml
Created July 4, 2011 00:32
processing xml with namespaces with python
<?xml version="1.0" encoding="UTF-8"?>
<hen:logs xmlns:hen="http://www.site.de/schemas/logs/1.0">
<!--<hen:vhost>
<hen:uuid></hen:uuid>
</hen:vhost>-->
<hen:vhost>www.site1.de
<hen:uuid>c5328180-e52b-4af5-bf6e-7a9e7c1754e2</hen:uuid>
</hen:vhost>
<hen:vhost>www.site2.de
<hen:uuid>b7b968db-27c7-4430-8346-b2c6e2de8065</hen:uuid>