Skip to content

Instantly share code, notes, and snippets.

@hitezh
hitezh / passenger_wsgi.py
Created June 13, 2011 15:47
Bottle on Dreamhost
# Detailed explanation at http://hitesh.in/2011/running-a-bottle-py-app-on-dreamhost/
#1. Add current directory to path, if isn't already
import os, sys
cmd_folder = os.path.dirname(os.path.abspath(__file__))
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
import bottle
from bottle import route, run
@textarcana
textarcana / git-log2json.sh
Last active July 14, 2024 12:16
Convert Git logs to JSON. The first script (git-log2json.sh) is all you need, the other two files contain only optional bonus features 😀THIS GIST NOW HAS A FULL GIT REPO: https://github.com/context-driven-testing-toolkit/git-log2json
#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%aN <%aE>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
@Kub-AT
Kub-AT / admin.py
Created September 8, 2012 15:36
Django flatpages and Redactorjs (WYSIWYG editor)
"""
Redactorjs: http://redactorjs.com/
django-redactorjs: https://github.com/TigorC/django-redactorjs
"""
from django.contrib import admin
from django.contrib.flatpages.models import FlatPage
from django.contrib.flatpages.admin import FlatPageAdmin as OldFlatPageAdmin
from django.contrib.flatpages.admin import FlatpageForm as OldFlatpageForm
@nagyv
nagyv / middleware.py
Created October 29, 2012 09:32
Django facebook connect middleware w/ facepy
import logging
import facepy as facebook
from django.conf import settings
from django.contrib.auth.signals import user_logged_in
from django.db import models
from django.contrib.auth import logout
from django.contrib.auth.models import User
class FBAuthMiddleware(object):
def __init__(self):
@nigma
nigma / serve.py
Created December 20, 2012 22:44
Serving Django with CherryPy
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import webbrowser
from threading import Timer
os.environ["DJANGO_SETTINGS_MODULE"] = "webapp.settings"
import cherrypy
anonymous
anonymous / install-sublime.sh
Created February 28, 2013 14:04
Install and patch sublime-text-2 on ubuntu
#!/bin/bash
echo "Installing sublime-text2..."
sudo add-apt-repository -y ppa:webupd8team/sublime-text-2
sudo apt-get update
sudo apt-get -y install sublime-text
# patch it
# http://menteleal.blogspot.com.ar/2012/12/sublime-text-2-full-license-key-en.html
echo "Applying the medicine..."
@btel
btel / add_gh_button.user.js
Last active October 8, 2017 00:01
Open IPython notebook from Github in NBViewer
// ==UserScript==
// @name NBViewer GitHub Button
// @description Open IPython notebook from Github in NBViewer
// @version 0.12
// @namespace http://telenczuk.pl
// @grant none
// @include http*://github.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js
// ==/UserScript==
@punchagan
punchagan / gh-ipynb.user.js
Last active October 8, 2017 00:02
GitHub IPynb rendering
// ==UserScript==
// @name GitHub IPynb rendering
// @namespace ghipynb
// @version 0.3.1
// @description Renders raw IPython notebooks on GitHub using nbviewer and Frames!
// @license WTFPL
// @match *://*.github.com/*
// @match *://github.com/*
// @match *://gist.github.com/*
// @grant none
@eduardschaeli
eduardschaeli / Dockerfile
Last active July 28, 2016 01:18
Creates a Docker image with IPython Notebook installed.
# iPython Notebook with per-user storage and config
#
# Based on crosbymichael/ipython
# Creates a Docker image with IPython Notebook installed.
#
# It expects to be run like this:
#
# docker run -v /home/eduard/notebooks/eduard:/notebooks benthoo/ipython-user
#
# You provide a folder per user on the host system. This folder will hold the users notebooks and also needs to contain the
import time
import re
import unicodedata
'''
listado de palabras que quiero descartar
'''
pal_comunes = ['los','las','sin','con','tan','por']
lista_categorias = ['lacteos','comestibles','auto','hogar']
lista_productos = ['leche','huevo','aceite','yerba']