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 | |
# | |
# manejador de sesiones | |
# | |
$sessiondb = pg_pconnect('dbname=sessions user=bob password=secret'); | |
function on_session_start($save_path, $session_name) { | |
error_log("on_session_start: " . $session_name . " ". session_id()); | |
} |
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
server { | |
# this is to serve a 200.txt static file | |
listen 8888; | |
root /usr/share/nginx/html/; | |
} | |
server { | |
listen 8999; | |
location / { | |
rewrite ^ /200.txt break; | |
} |
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
#!/usr/bin/python | |
import re | |
f = open('municipio.kml', 'r') | |
line = f.readline() | |
while line: | |
rline = line.rstrip() | |
redata = re.match('<coordinates>(.*?)</coordinates>',line) | |
if redata: |
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 | |
$WSDL = 'http://example.com/?wsdl'; | |
$client = new SoapClient( $WSDL ); | |
$res = $client->consultaServicios(array('movil'=>'55555555', 'pass'=>'***')); | |
print_r($res); |
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 | |
function consultaServicios($movil, $pass, $url){ | |
require_once('nusoap/nusoap.php'); | |
$cliente = new nusoap_client($url, true); | |
$err = $cliente->getError(); | |
if($err){ | |
$res = "->".$err; | |
return $res; | |
} | |
$params = array('movil' => $movil, 'pass' => $pass); |
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
$ telnet localhost 25 | |
<< 220 mailserver.example.org ESMTP Sendmail; Tue, 13 Mar 2012 13:52:06 -0600 | |
>> HELO my.example.com | |
<< 250 mailserver.example.org Hello localhost [127.0.0.1], pleased to meet you | |
>> MAIL FROM:[email protected] | |
<< 250 2.1.0 [email protected]... Sender ok | |
>> RCPT TO:[email protected] | |
<< 250 2.1.5 [email protected]... Recipient ok | |
>> DATA | |
<< 354 Enter mail, end with "." on a line by itself |
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 number_format(x=0, precision=2, currency="US$ "): | |
x = Decimal('%.4f' % x) | |
fformat = '%.' + str(precision) + 'f' | |
nombres = ['', ' mil', ' millones'] | |
if x < 1000: | |
s = (fformat % x).rstrip('0').rstrip('.') | |
s = s + nombres[0] | |
if 1000 <= x < 1000000: | |
s = (fformat % (x / 1000)).rstrip('0').rstrip('.') | |
s = s + nombres[1] |
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
#!/usr/bin/python | |
# taken from http://stackoverflow.com/a/344083/1170404 | |
# usage: cat filemame.txt | ./utmToLatLng.py | |
import math | |
import fileinput | |
# zone = 16 (Nicaragua) | |
def utmToLatLng(easting, northing, northernHemisphere=True, zone=16): |
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
server { | |
listen 192.168.1.1:80; | |
server_name example.com; | |
root /var/www/example/static; | |
access_log /var/log/nginx/example-access.log; | |
location = /favicon.ico { access_log off; log_not_found off; } | |
location /media { | |
root /var/www/example/; | |
} |
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
#!/bin/sh | |
SITE_PATH=/var/www/example/; export SITE_PATH | |
USER=apache | |
#TCP=$HOSTNAME:8888 | |
TCP=127.0.0.1:8888 | |
runuser $USER -s /bin/bash -g $USER -c "/usr/bin/gunicorn_django -b ${TCP} -w 3 --max-requests=1000 ${SITE_PATH}settings 2>&1" |
OlderNewer