Skip to content

Instantly share code, notes, and snippets.

View alexander-ae's full-sized avatar

Alexander alexander-ae

View GitHub Profile
@alexander-ae
alexander-ae / ansistrm.py
Created August 11, 2012 01:09 — forked from vsajip/ansistrm.py
Python logging: colourising terminal output
#
# Copyright (C) 2010-2012 Vinay Sajip. All rights reserved. Licensed under the new BSD license.
#
import ctypes
import logging
import os
class ColorizingStreamHandler(logging.StreamHandler):
# color names to indices
color_map = {
@alexander-ae
alexander-ae / memcached.config
Created March 17, 2013 02:27
Configuración de memcached para systemd
PORT="11211"
USER="user"
MAXCONN="512"
CACHESIZE="32"
PID="/home/user/.memcached.pid"
OPTIONS=""
[program:mongodb]
directory=/home/username/webapps/appname
command=/home/username/webapps/mongodb-appname/mongodb-linux-i686-2.0.1/bin/mongod --dbpath /home/username/webapps/mongodb-appname/data --logpath /home/username/webapps/mongodb-appname/log/corsdb.log --logappend --port 34006
import re
from django.utils.text import compress_string
from django.utils.cache import patch_vary_headers
from django import http
try:
import settings
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS
@alexander-ae
alexander-ae / crontab
Created August 13, 2014 21:16
Webfaction: supervisord + nginx
*/1 * * * * /home/{user}/webapps/{app}/nginx/sbin/nginx -c /home/{user}/webapps/{app}/nginx/conf/nginx.conf >> $HOME/tmp/cron.log 2>&1 ;
*/1 * * * * cd /home/{user}/bin/supervisord; /home/{user}/etc/supervisord.sh start >> $HOME/tmp/cron.log 2>&1 ;
@alexander-ae
alexander-ae / crontab
Last active August 29, 2015 14:06
Configuración de django + apache
*/5 * * * * source ~/.bashrc && ~/webapps/django_1_5/apache2/bin/start
@alexander-ae
alexander-ae / crontab -e
Last active September 8, 2016 17:17
Digital Ocean: Django + Nginx + uwsgi
# */2 * * * * /home/devstaff/opt/nginx/sbin/nginx -c /home/devstaff/opt/nginx/conf/nginx.conf >> $HOME/tmp/cron.log 2>&1 ;
*/2 * * * * cd /usr/local/bin/supervisord; /home/devstaff/etc/supervisord.sh start >> $HOME/tmp/cron.log 2>&1 ;
@alexander-ae
alexander-ae / debug_css.js
Last active November 3, 2021 18:42
Debug CSS with js
[].forEach.call($$("*"),function(a){
a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)
})
/* version 2 */
[].forEach.call(document.querySelectorAll("*"),function(a){a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)})
@alexander-ae
alexander-ae / httpd.conf
Created November 5, 2014 15:23
Configuración de apache para python
Alias /static_hv "C:/proys/static_proyecto/"
<Directory "C:/proys/static_proyecto">
AllowOverride AuthConfig
Require all granted
</Directory>
WSGIScriptAlias / "C:\proys/staff-proyecto/src/settings/wsgi.py"
WSGIPythonPath "C:/proys/staff-proyecto/src"
@alexander-ae
alexander-ae / check_parents.py
Last active August 29, 2015 14:09
Plugin para verificar la ruta de un selector css
import sublime
import sublime_plugin
import re
import os
class CheckParentCommand(sublime_plugin.TextCommand):
def run(self, edit):
# inicializa