This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
import time, datetime | |
def print_time(when=time.time()): | |
print when | |
def print_date(when=datetime.datetime.now()): | |
print when |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# urls.py | |
urlpatterns = patterns('', | |
url('^galerias/$', | |
active_generic_view, | |
{'view': object_list, 'model': MediaCenter, 'paginate_by': 20}, | |
name='webmedia_mediacenter_list'), | |
url(r'^(?P<category_slug>[-\w]+)/galerias/$', 'mediacenter_category_list', | |
name='webmedia_mediacenters_category_list'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
site = Site.objects.get_current() | |
absolute_url = 'http://%s%s' % (site.domain, | |
instance.get_absolute_url()) | |
instance.short_url = vamu_url_shortening(absolute_url) | |
def vamu_url_shortening(url): | |
url = urllib2.quote(url, safe='') | |
vamu_api = 'http://va.mu/api/create/?url=%s' % (url) | |
response = urllib2.urlopen(vamu_api).read() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# written by Arthur Furlan <[email protected]> | |
# check program usage | |
if [ $# -lt 1 ]; then | |
echo "Usage: $0 DEVICE" | |
exit 1 | |
elif ! [ -e "$1" ]; then | |
echo "Error: device '$1' not found." | |
exit 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# written by Arthur Furlan <[email protected]> | |
from __future__ import with_statement | |
from fabric.api import * | |
import socket | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('VAMU_API_CREATE', 'http://va.mu/api/create?url=%s'); | |
define('VAMU_API_PREVIEW', 'http://va.mu/api/preview?url=%s'); | |
function _consume_webservice($url) { | |
$options = array( | |
CURLOPT_RETURNTRANSFER => true, // return web page | |
CURLOPT_HEADER => false, // don't return headers | |
CURLOPT_FOLLOWLOCATION => true, // follow redirects | |
CURLOPT_ENCODING => "", // handle all encodings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# BaseConverter used in django-shorturls: https://github.com/jacobian/django-shorturls | |
# https://github.com/jacobian/django-shorturls/blob/master/src/shorturls/baseconv.py | |
from shorturls.baseconv import BaseConverter | |
# SequenceMapper used in django-shortim: https://github.com/valvim/django-shortim | |
# https://github.com/valvim/django-shortim/blob/master/src/shortim/models.py | |
from shortim.sequencemapper import SequenceMapper, SHORTIM_SHORTURL_CHARS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# written by Arthur Furlan <[email protected]> | |
# check the script usage | |
if [ $# -lt 1 ]; then | |
echo "Usage: $0 PATH [FROM-ENCODING] [TO-ENCODING]" | |
exit 1 | |
elif [ ! -d $1 ]; then | |
echo "Error: directory $1 not found." | |
exit 2 |
NewerOlder