Skip to content

Instantly share code, notes, and snippets.

View soncco's full-sized avatar
🏠
Working from home

Braulio Soncco soncco

🏠
Working from home
View GitHub Profile
@soncco
soncco / 1. django+gunicorn+nginx
Last active September 16, 2017 22:08
Manera fácil de hacer Deploy con Django en un VPS.
# Create sudo user
adduser <user>
usermod -a -G sudo <user>
logout
# Update and clean
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove
@soncco
soncco / rgb.html
Created October 24, 2013 03:14
Pequeño ejemplo de colores con RGB.
<!doctype html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
float: left;
}
</style>
@soncco
soncco / ubuntu14.04
Created June 13, 2014 00:05
Ubuntu 14.04
#!/bin/sh
###############################################################################
############# CONFIGURADOR SERVER ESTANDAR LAMP UBUNTU 14.04 ##################
################################################################## v 0.1 ######
##### ejecutar como root (sin sudo) ###########################################
##### requisitos: #############################################################
##### *) ssh y ssh_keys instaladas ############################################
##### *) particiones extras montadas (/home/mysql, swap) ######################
##### *) resolv.conf contiene los dns validos (google o isp) ##################
@soncco
soncco / bootstrap.css
Created June 25, 2014 18:08
Python xhtml2pdf Bootstrap3 CSS
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
@soncco
soncco / scroll.js
Created August 1, 2014 03:31
Simple bootstrap menu animation
$(window).scroll(function() {
if ($(".conciencia").offset().top>50)
$(".conciencia").addClass("complete");
else
$(".conciencia").removeClass("complete");
});
import urllib, urllib2, pytesseract, os
from PIL import Image
f = open('/tmp/captcha.jpg', 'wb')
f.write(urllib.urlopen('http://www.sunat.gob.pe/cl-ti-itmrconsruc/captcha?accion=image').read())
f.close()
codigo = pytesseract.image_to_string(Image.open('/tmp/captcha.jpg'))
print codigo
os.remove('/tmp/captcha.jpg')
data = [('codigo', codigo), ('accion', 'consPorRuc'), ('nroRuc', '20549949232'),]
@soncco
soncco / acta
Created March 14, 2015 00:04
Printable double page
# -*- coding: utf-8 -*-
from functools import partial
import datetime
from reportlab.lib.pagesizes import letter, A4
from reportlab.platypus import SimpleDocTemplate, Paragraph, Table, TableStyle, Image, Spacer
from reportlab.platypus import PageTemplate, BaseDocTemplate, NextPageTemplate, PageBreak, Frame
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER, TA_RIGHT, TA_LEFT
@soncco
soncco / shell.sh
Created June 24, 2015 17:01
uwsgi and django
sudo apt-get install uwsgi uwsgi-plugin-python
cd /etc/uwsgi/apps-available
sudo vim site.ini
# View site.ini
cd ..
cd apps-enabled
ln -s ../apps-available/site.ini
sudo service uwsgi restart
cd /etc/nginx/sites-available
sudo vim site.conf
function epsacrop_element_info_alter(&$type) {
$type['managed_file']['#process'][] = 'epsacrop_element_process';
if (module_exists('multiupload_filefield_widget')) {
$type['mfw_managed_file']['#process'][] = 'epsacrop_element_process';
}
if (module_exists('media')) {
$type['media']['#process'][] = 'epsacrop_element_process';
}
}
cd sites/all/default
mkdir files
su foreign
sudo chown -R www-data:www-data files
exit
cp default.settings.php settings.php
chmod 777 settings.php