Skip to content

Instantly share code, notes, and snippets.

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

Samuel Loza Ramirez samuelloza

🏠
Working from home
View GitHub Profile
Apache2
Desactivar index
a2dismod autoindex
sudo service apache2 restart
https cerbot-auto
https://certbot.eff.org/docs/install.html
wget https://dl.eff.org/certbot-auto
@samuelloza
samuelloza / gist:52ee3727ad2e8d3e99fd56fd468bb365
Last active February 28, 2018 21:18
Replicador Postgres
https://www.howtoforge.com/tutorial/how-to-set-up-master-slave-replication-for-postgresql-96-on-ubuntu-1604/
cd /etc/postgresql/9.4/main/
nano postgresql.conf
listen_addresses = 'IP_MASTER o * para cualquier IP'
wal_level = hot_standby
synchronous_commit = local
archive_mode = on
@samuelloza
samuelloza / txt
Created February 28, 2018 21:49
Backup data
#!/bin/bash
# Script para hacer la copia de seguridad desde 192.168.188.5 a
# 192.168.188.4 (servidor espejo)
function loginfo(){
myUser="rsync"
logger -p user.info "${myUser}[$$]: $1"
}
@samuelloza
samuelloza / sh
Last active February 28, 2018 22:14
Backup Postgres.sh
#!/bin/bash
#
# Postgres backup script
# This script must be run with root mysql account
#
# POSTGRES connection info
MYUSER=postgres
MYPASS=Zorro1
MYHOST=localhost
@samuelloza
samuelloza / txt
Created May 23, 2018 21:32
Mysql FEDERATED
mysql FEDERATED es un link de una tabla a otra tabla remota,
no es bueno usar si se tienen muchos datos.
Si son pocos pues aquí la solución a menos que quieras construir un script de sincronización y ponerlo en un crontab
-- Tabla con conexion a una base de datos remota
CREATE TABLE tabla_remota
(
id INT NOT NULL AUTO_INCREMENT,
campo1 VARCHAR(32),
@samuelloza
samuelloza / vcl-regex-cheat-sheet
Created August 7, 2018 00:46 — forked from dimsemenov/vcl-regex-cheat-sheet
Regular expression cheat sheet for Varnish (.vcl). Examples of vcl regexp. Found here http://kly.no/varnish/regex.txt (by Kristian Lyngstøl)
Regular expression cheat sheet for Varnish
Varnish regular expressions are NOT case sensitive. Varnish uses POSIX
regular expressions, for a complete guide, see: "man 7 regex"
Basic matching:
req.url ~ "searchterm"
True if req.url contains "searchterm" anywhere.
req.url == "searchterm"
@samuelloza
samuelloza / sphinx_tain.cfg
Created August 8, 2018 14:30
sphinx_tain.cfg
# Configuration script for sphinx trainer -*-mode:Perl-*-
$CFG_VERBOSE = 1; # Determines how much goes to the screen.
# These are filled in at configuration time
$CFG_DB_NAME = "aymara";
# Experiment name, will be used to name model files and log files
$CFG_EXPTNAME = "$CFG_DB_NAME";
# Directory containing SphinxTrain binaries
server {
listen 8080 default;
listen [::]:8080 default;
server_name www.dominio.com.bo dominio.com.bo;
root /var/www/html/dominio.com.bo/;
fastcgi_buffers 8 4K;
location /pma {
root /var/www/html/;
Este codigo compilara sin problemas
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
//Su codigo
return 0;
import java.util.Scanner;
class Main{
public static void main(String[] args) {
//tu codigo
}
}