Skip to content

Instantly share code, notes, and snippets.

View kaosb's full-sized avatar
🚀
get shit done

Felipe González kaosb

🚀
get shit done
View GitHub Profile
#!/bin/bash
#### AWS Config
export AWS_ACCESS_KEY_ID=key_id
export AWS_SECRET_ACCESS_KEY=key
#### DB Config
USER=database_user
PASSWORD=database_password
HOST=database_host
DB=database_name
#### Backup Config
@kaosb
kaosb / validation.md
Created January 31, 2019 16:02 — forked from cotocisternas/validation.md
rails custom validations

Rails Custom Validations

app/models/doc.rb

# frozen_string_literal: true

class Doc
  include Mongoid::Document
  include Mongoid::Timestamps
ssh -D 8123 -f -C -q -N [email protected]
-D: Tells SSH that we want a SOCKS tunnel on the specified port number (you can choose a number between 1025-65536)
-f: Forks the process to the background
-C: Compresses the data before sending it
-q: Uses quiet mode
-N: Tells SSH that no command will be sent once the tunnel is up
Luego configuramos en el browser un proxy sock a la IP de la maquina donde se creo el proxy en este caso localhost y al puerto en cuestion.
/**
* [get_aportes_por_comuna_por_region_func]
* @param [param] $data [contiene e id de la comuna.]
* @return [array] [retorna el detalle de aportes por partido y por comuna.]
*/
function get_aportes_por_comuna_por_region_func($data)
{
global $wpdb;
$region_id = $data['id'];
// TODO: falta limitar el resultado a solo los aportes del 2016
/**
* Regiones, provincias, y comunas.
*/
global $rpc_epm_db_version;
$rpc_epm_db_version = '1.0';
function rpc_epm_install() {
// $con = mysqli_connect('localhost', 'root', 'kaosbite', 'cl_lupaelectoral');
// if(!mysqli_connect_errno()){
// $sql = file_get_contents(ABSPATH . 'wp-content/plugins/ep-municipales-data/base/BDCUT_CL__MYSQL5_INNODB_UTF8.sql');
// mysqli_query($con, $sql);
@kaosb
kaosb / gist:249f87e261e64c017200
Created June 17, 2015 04:37
Generar PEM de acceso
Es bueno considerar usar el passphrase
cd .ssh/
Generate the file id_dsa from which we will create the PEM file:
ssh-keygen -t dsa -b 2048
Generate the private key PEM file:
openssl dsa -in id_dsa -outform pem > pk_dsa.pem
Generate the public key PEM file for distribution to the users:

SSH client problem, Perl:

vagrant@squeeze32:~$ perl -v
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

<?php
include("conexion.php");
if(isset($_POST['ref']) && !empty($_POST['ref']) && $_POST['ref'] != 'undefined' && isset($_COOKIE['heladero']) && !isset($_COOKIE['heladerorefvote'])){
// En vaso de tener la cookie y estar referido busco a mi amigo para votar por el.
$ref = $_POST['ref'];
$result = mysql_query( " SELECT * FROM participantes WHERE userID = $ref", $link);
}else{
// En caso de tratarse de un usuario sin la cookie eso quiere decir que no viene referido.
$exclude = (isset($_POST['userID']) && !empty($_POST['userID']) && $_POST['userID'] != 'undefined') ? $_POST['userID'] : '' ;
$exclude = (isset($_POST['ref']) && !empty($_POST['ref']) && $_POST['ref'] != 'undefined') ? $exclude.", ".$_POST['ref'] : $exclude ;