String a = String.valueOf(2);
int i = Integer.parseInt(a);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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(""); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 = '[email protected]' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.JOptionPane; | |
/** | |
* | |
* @author coder | |
*/ | |
public class IntercambiarColumna { | |
public static void main(String[] args) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################# | |
# 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 |
NewerOlder