Skip to content

Instantly share code, notes, and snippets.

View paridin's full-sized avatar
🎯
Focusing

Roberto Estrada paridin

🎯
Focusing
View GitHub Profile
@paridin
paridin / deploy_aws_from_cero.md
Last active February 6, 2016 13:13
Install on AWS Nginx 1.8 + Passenger 5.0 + Postgresql 9.4 + Python 3.4.3 + Django 1.8.4 + Redmine 3.1

AWS Nginx 1.8 + Passenger 5.0 + Postgresql 9.4 + Python 3.4.3 + Django 1.8.4 + Redmine 3.1

In our aws instance we follow the next steps

$ sudo yum update
$ sudo yum -y groupinstall "Development Tools"
$ sudo yum  -y install memcached memcached-devel ImageMagick ImageMagick-devel openssl openssl-devel libcurl-devel nginx
$ sudo yum -y erase nginx # for fix an error of 403 forbbiden it ocurrs after but doing it all works fine
@paridin
paridin / nginx
Created August 29, 2015 07:22
nginx daemon aws updated
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /etc/nginx/nginx.conf
# config: /etc/sysconfig/nginx
@paridin
paridin / guide_install_gem_fgci.md
Last active August 28, 2015 23:10
A helper for install fcgi using ruby in a share hosting.

Some times we have a share hosting without privileges, my goal for today, is set up a redmine instance in my hosting actually I have a instance with a2hosting, but i think it will be the same steps for others because I always work with my home directory

Currently I work with custom struct $HOME/.local for every local install and my custom temp dir is $HOME/.local/tmp

$HOME/.local/share
$HOME/.local/bin
$HOME/.local/lib
$HOME/.local/include
$HOME/.local/tmp
@paridin
paridin / install_py3.7.sh
Last active September 5, 2018 17:55
a simple script for install python3.7 on *nix systems
#!/bin/bash
# Copyright (c) 2015, Roberto Estrada
# All rights reserved.
# Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
# 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
# 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
@paridin
paridin / insert_or_update
Last active August 29, 2015 14:24
Compare objects list and get a list of object to inserted or updated
"""
Problem You have an input json with which you will create a list of objects, you have to validate that the object will be created if it not exists, if exists determine whether to upgrade or discard depending of they have not undergone any changes.
Solution 1) With the input json will be created the list of objects of the class that we insert or updatee
2) Read all fields in the database, using one of the fields as key to creating a dictionary with the objects in the database
3) Compare the objects and determine if it will be updated, inserted or discarded
Django problem: by default only compares the level objects using the primary key (id). Compare field by field is the solution to determine if the object has changed. hints: The _state field is present in every object, and it will produce a random memory location, You can find cache fields so you need to remove these begins with underscore _. The fields excluded can be fk, and these fields produce field_id, so you will needs to exclude it