Skip to content

Instantly share code, notes, and snippets.

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

Juan Sebastian Ocampo Ospina Capriatto

🏠
Working from home
View GitHub Profile
// some useful functions in mql4
// Alert() prints an alert with sound and window. So, it's useful to important notifications
// make sure you always cast numbers to string in order to avoid warnings in the console
Alert("");
// Print() prints a message in the experts page in the mt4's terminal window
// This is intended to inform the user all the changes that the expert or the script does.
// This is more quiet than the alarm type.
Print("");
@Capriatto
Capriatto / website-monitoring-1
Created March 4, 2020 19:19 — forked from adeekshith/website-monitoring-1
Scripts for website monitoring using Python
#!/usr/bin/env python
# sample usage: checksites.py eriwen.com nixtutor.com yoursite.org
import pickle, os, sys, logging
from httplib import HTTPConnection, socket
from smtplib import SMTP
def email_alert(message, status):
fromaddr = 'you@gmail.com'
#proxying requests to other server.
upstream webserver {
server 127.0.0.1:8069 weight=1 fail_timeout=600s;
}
#server listening 80 port
server {
listen 80;
server_name example.com;
@Capriatto
Capriatto / ScriptActualizarModulosOpenerp7.sh
Created June 26, 2018 06:00
Este Script permite actualizar todas las bases de datos del servidor OpenERP 7 de forma automatizada.
#!/bin/bash
#permite obtener los nombres de las bases de datos
OUTPUT="$(psql -U openerp -d template1 -X -t -A -c "SELECT datname FROM pg_database where datname not in ('template0', 'template1', 'postgres')")"
read -a arr_ids_temp <<< $OUTPUT #crea un arreglo con los nombres
tamanio=${#arr_ids_temp[@]} #tamaño del arreglo
mult_cuatro=(4 8 12 16 20 24 28 32 36 40 44 48 52 56 60 64 68 72 76 80 84 88 92 96 100) #Estos multiplos de 4 se usan para actualizar las bases de datos en grupos de 4.
PID_list=() #arreglo que almacena el id de los 4 procesos que estan actualizando bases de datos
@Capriatto
Capriatto / bash
Created June 24, 2018 00:11 — forked from forkb0mb84/bash
bash
#!/bin/bash
# First line of the script is shebang which tells the system how to execute
# the script: http://en.wikipedia.org/wiki/Shebang_(Unix)
# As you already figured, comments start with #. Shebang is also a comment.
# Simple hello world example:
echo Hello world!
# Each command starts on a new line, or after semicolon:
echo 'This is the first line'; echo 'This is the second line'
@Capriatto
Capriatto / java-snippets.md
Created March 1, 2018 22:03 — forked from thomd/java-snippets.md
Java code snippets

Java Snippets

Converting Strings to int and int to String

String a = String.valueOf(2); 
int i = Integer.parseInt(a);  

Convert String to Date

@Capriatto
Capriatto / normalise.py
Created April 1, 2016 23:37 — forked from j4mie/normalise.py
Normalise (normalize) unicode data in Python to remove umlauts, accents etc.
# -*- coding: utf-8 -*-
import unicodedata
""" Normalise (normalize) unicode data in Python to remove umlauts, accents etc. """
data = u'naïve café'
normal = unicodedata.normalize('NFKD', data).encode('ASCII', 'ignore')
print normal
@Capriatto
Capriatto / gist:3aff8f477fe0f1e11b86
Created December 15, 2015 23:37 — forked from ashokdhudla/gist:b1bf69088c2931d601cc
odoo 8 installation in ubuntu 14.04
Step 1. Build your server
sudo apt-get install openssh-server
sudo apt-get update
sudo apt-get dist-upgrade
Step 2. Create the Odoo user that will own and run the application
sudo adduser --system --home=/opt/odoo --group odoo
sudo su - odoo -s /bin/bash
exit
@Capriatto
Capriatto / Intercambiar dos columnas de una matriz en java
Last active August 28, 2015 15:08
This example allows you interchange a matrix column.
import javax.swing.JOptionPane;
/**
*
* @author coder
*/
public class IntercambiarColumna {
public static void main(String[] args) {
#############################################
# Push de la rama actual
git push origin $rama_actual
#############################################
# Volver a un commit anterior, descartando los cambios
git reset --HARD $SHA1
#############################################
# Ver y descargar Ramas remotas