Skip to content

Instantly share code, notes, and snippets.

View alexander-ae's full-sized avatar

Alexander alexander-ae

View GitHub Profile
@alexander-ae
alexander-ae / wsgi.py
Created January 6, 2015 19:41
wsgi.py (windows)
import os
import sys
from os.path import dirname, realpath
# directorio del proyecto
SITE_ROOT = dirname(realpath(__file__))
# entorno
sys.path = [SITE_ROOT, 'C:\Python27\Lib\site-packages'] + sys.path
@alexander-ae
alexander-ae / web.conf
Created February 5, 2015 15:08
nginx: django + wordpress
server {
listen 80;
# server_name base.pe;
server_tokens off;
root /home/devstaff/webapps/;
location /blog {
index index.php index.html index.htm;
@alexander-ae
alexander-ae / comments.tag
Last active August 29, 2015 14:15
riot + parse
<comment-box>
<h1>{ opts.title }</h1>
<comment-list comments={ comments } />
<comment-form />
this.comments = []
add(comment) {
this.comments.push(comment)
@alexander-ae
alexander-ae / .htaccess
Last active August 29, 2015 14:18
www to non www
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# non www to www and https
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
@alexander-ae
alexander-ae / sql
Created April 16, 2015 16:21
wordpress - replace url
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
$("#{{ inline_admin_formset.formset.prefix }}-group").grp_inline({
prefix: "{{ inline_admin_formset.formset.prefix }}",
//////////Función agregada para precargar y ejecutar el complemento tinyMCE
onBeforeAdded:function(form) {
if (tinyMCE != undefined) {
django.jQuery('.grp-empty-form').find('textarea').each(function() {
var tid = django.jQuery(this).attr("id");
tinyMCE.execCommand("mceRemoveControl",false,tid);
});
@alexander-ae
alexander-ae / httpd.conf
Last active February 1, 2016 19:47
nginx/apache redirect www and ssl
Nginx no-www to www
-------------------
server {
#listen 80 is default
server_name www.example.com;
return 301 $scheme://example.com$request_uri;
}
server {
#listen 80 is default
@alexander-ae
alexander-ae / install-comodo-ssl-cert-for-nginx.rst
Created October 12, 2015 22:59 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@alexander-ae
alexander-ae / settings.py
Created December 13, 2015 02:14 — forked from ndarville/settings.py
Django on Travis CI
"""A basic database set-up for Travis CI.
The set-up uses the 'TRAVIS' (== True) environment variable on Travis
to detect the session, and changes the default database accordingly.
Be mindful of where you place this code, as you may accidentally
assign the default database to another configuration later in your code.
"""
import os
@alexander-ae
alexander-ae / killall.sh
Created April 7, 2016 15:53
kill all process by pattern
ps -ef | grep myProcessName | grep -v grep | awk '{print $2}' | xargs kill -9