Skip to content

Instantly share code, notes, and snippets.

View mgallego's full-sized avatar

Moises Gallego mgallego

View GitHub Profile
--exclude=*.hg*
--exclude=*.cvs*
--exclude=*.svn*
--exclude=*.git*
--exclude=*compiled*
--exclude=*public_html*
--exclude=*.idea*
--exclude=*bower_components*
--exclude=*images*
--exclude=*.DS_Store*
@mgallego
mgallego / .emacs.lisp
Created April 12, 2017 13:35
Configure Geben with VM
(setq geben-path-mappings '(("/home/moises/dev/my-project" "/vagrant")))
@mgallego
mgallego / remove.sh
Created October 4, 2016 10:51
Delete all Docker containers and images
#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)
@mgallego
mgallego / move_videos.sh
Created July 4, 2015 13:50
Transmission script for get the videos from a downloaded torrent and move to a new directory
#!/bin/sh
SOURCEDIR='/downloaded/torrents/directory/absolute/path'
TARGETDIR='/target/directory/absolute/path/'
counter=0
find $SOURCEDIR -type f -exec file -N -i -- {} + | sed -n 's!: video/[^:]*$!!p' | while read -r file
do
output=$(date +"%s")-${counter}_${file##*/}
mv "${file}" "${TARGETDIR}/${output}"
@mgallego
mgallego / Twig-functions.el
Created January 6, 2013 22:49
A few functions in emacs lisp to play with twig templates.
(defun twig-trans-text (text)
"print-a-text-in-a-twig-trans-label"
(interactive "sText:")
(insert (concat "{% trans %}" text "{% endtrans %}"))
)
(defun twig-trans-region ()
"include-a-region-between-trans-labels"
(interactive)
"print-a-text-in-a-twig-trans-label"
@mgallego
mgallego / jean_claude.el
Created November 2, 2012 10:48
Jean Claude Functions
(defun jean-claude (var)
"print-a-php-var-dump"
(interactive "sVar:")
(setq init-point (point))
(insert (concat "echo '<pre>';\nvar_dump(" var ");\necho '<\pre>';"))
(indent-region init-point (point))
)
(defun doctrine-jean-claude (var)
"print-a-php-var-dump"
from pymongo import Connection
import yaml, datetime, smtplib
class Logger():
def set_message(self, message):
mongo = Mongo()
mongo.insert_message(message)
@mgallego
mgallego / gist:3841846
Created October 5, 2012 19:29
Estado inicial de PHPDocumentor.el
(defun phpdoc ()
"print-the-php-documentor-block"
(interactive)
(search-backward " function")
(setq method-name (phpdoc-get-method-description))
(phpdoc-block-position)
(setq init-block-point (point))
(phpdoc-start-line)
(phpdoc-new-line method-name)
(phpdoc-new-line)
@mgallego
mgallego / gist:1876083
Created February 21, 2012 11:50
WebService Python
#!/usr/bin/env python
from twisted.web import server, resource
from twisted.internet import reactor
from twisted.python import log
import sys
from datetime import datetime
class Root(resource.Resource):
def render_GET(self, request):
return 'Welcome to Picmnt Api'