This file contains 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
<VirtualHost *:80> | |
ServerAdmin admin@project_name.com | |
ServerName project_name.com | |
ServerAlias www.project_name.com | |
# DocumentRoot: not the django project root, just to be safe | |
DocumentRoot /var/app/project_name/fcgi | |
# Logs | |
ErrorLog /var/log/apache2/project_name-error_log |
This file contains 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
from shapely.geometry import shape, Point, MultiPoint | |
import math | |
import json | |
def get_bounds(geometries): | |
"""Returns bounding box of geometries. Implementation creates a MultiPoint | |
from the boxes of all polygons in order to get the result""" | |
points = [] | |
for g in geometries: |
This file contains 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
function check_django_password($plaintext, $hashed) { | |
$parts = explode('$', $hashed); | |
if(count($parts) != 3) return FALSE; | |
if($parts[0] == 'sha1' && sha1($parts[1] . $plaintext)) == $parts[2]) | |
return TRUE; | |
if($parts[0] == 'md5' && md5($parts[1] . $plaintext)) == $parts[2]) | |
return TRUE; | |
return FALSE; | |
} |
This file contains 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
import sh | |
import os | |
import re | |
from path import path | |
home = os.environ['HOME'] | |
p = path.joinpath(home, 'Documents', 'pki', 'nfe', 'certs') | |
if not p.isdir(): | |
p.makedirs() |
This file contains 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
def quebra_linha(frase, largura): | |
linha = "" | |
linhas = [] | |
for palavra in frase.split(): | |
largura_atual = text_extents(linha + palavra) | |
if largura_atual > largura: | |
if not linha: | |
raise Exception('Frase não cabe nesta largura') | |
linhas.append(linha) | |
linha = palavra |
This file contains 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
import cairo | |
pol = 72.0 | |
mm = pol / 25.4 | |
surface = cairo.PDFSurface('teste.pdf', 210*mm, 297*mm) | |
ctx = cairo.Context(surface) | |
ctx.set_source_rgb (0, 0, 0) |
This file contains 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
#------------------------------------------------------------------------------- | |
# Name: validate_cnpj | |
# Purpose: check formal validity of a cnpj number (brazilian tax id) | |
# this only checks if the digits match, not if the number is | |
# valid at Receita Federal (Brazilian IRS) | |
# | |
# Author: Paulo Scardine <[email protected]> | |
# | |
# Created: 26/11/2012 | |
# Copyright: (c) PauloS 2012 |
This file contains 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 | |
/* .htaccess | |
RewriteRule markers?/([0-9a-fA-F]{6})/([0-9a-fA-F]{6})/([^/]+)/marker.png markers/index.php?bg=$1&fg=$2&icon=$3 | |
*/ | |
header('Content-type: image/png'); | |
// read parameters: icon file, foreground and background colors | |
$bgc = sscanf(empty($_GET['bg']) ? 'FFFFFF' : $_GET['bg'], '%2x%2x%2x'); | |
$fgc = sscanf(empty($_GET['fg']) ? '000000' : $_GET['fg'], '%2x%2x%2x'); |
This file contains 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
Windows Registry Editor Version 5.00 | |
[HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\Default%20Settings] | |
"Colour0"="101,123,131" | |
"Colour1"="88,110,117" | |
"Colour2"="253,246,227" | |
"Colour3"="238,232,213" | |
"Colour4"="238,232,213" | |
"Colour5"="101,123,131" | |
"Colour6"="7,54,66" |