mysql -u root -p CREATE DATABASE wordpress; CREATE USER wordpressuser@localhost; SET PASSWORD FOR wordpressuser@localhost= PASSWORD("password"); GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser@localhost IDENTIFIED BY 'password'; FLUSH PRIVILEGES; exit;
miércoles, 3 de septiembre de 2014
crear un usuario y dar permisos
jueves, 28 de agosto de 2014
Find all con parametros
$data =Trimestres::model()->findAll((array(
'condition'=>"id_periodo=$_POST[id_periodo]",
'order'=>'id'
)));
'condition'=>"id_periodo=$_POST[id_periodo]",
'order'=>'id'
)));
miércoles, 30 de julio de 2014
montar conexiones remotas
SSH
Para mapear/montar una carpeta de un servidor remoto como lo cal hay que utilizar sshfs, si no lo teneis instalado bastan con ejecutar en debian o derivados:
sudo apt-get install sshfs
Una vez instalado el programa tenemos que crearnos una carpeta en disco donde mapearemos el la ruta del servidor remoto, por ejemplo:
ruta local: /home/depruebas/www/servidor_remoto
En el servidor remoto queremos mapear la ruta:
/var/www/html/mi_proyecto_guay
La instrucción es la siguiente:
sshfs root@servidor.remoto.com:/var/www/html/mi_proyecto_guay /home/depruebas/www/servidor_remoto
Esto crea una carpeta en tu disco con los datos de la ruta del servidor remoto.
Para mapear/montar una carpeta de un servidor remoto como lo cal hay que utilizar sshfs, si no lo teneis instalado bastan con ejecutar en debian o derivados:
sudo apt-get install sshfs
Una vez instalado el programa tenemos que crearnos una carpeta en disco donde mapearemos el la ruta del servidor remoto, por ejemplo:
ruta local: /home/depruebas/www/servidor_remoto
En el servidor remoto queremos mapear la ruta:
/var/www/html/mi_proyecto_guay
La instrucción es la siguiente:
sshfs root@servidor.remoto.com:/var/www/html/mi_proyecto_guay /home/depruebas/www/servidor_remoto
Esto crea una carpeta en tu disco con los datos de la ruta del servidor remoto.
domingo, 27 de julio de 2014
Codigo de NodeBots
var keypress = require('keypress'),
five = require("johnny-five"),
board = new five.Board({
//port: '/dev/cu.itead-DevB'
port: '/dev/cu.usbmodem1411'
});
board.on("ready", function() {
console.log("Testint motors... ");
// motor = new five.Motor({
// pins: {
// pwm: 4,
// dir: 5
// }
// });
motor1Fwd = new five.Led({
pin: 5
});
motor1Rev = new five.Led({
pin: 4
});
motor2Fwd = new five.Led({
pin: 6
});
motor2Rev = new five.Led({
pin: 7
});
board.repl.inject({
motor1Fwd: motor1Fwd,
motor1Rev: motor1Rev,
motor2Fwd: motor2Fwd,
motor2Rev: motor2Rev
});
// make `process.stdin` begin emitting "keypress" events
keypress(process.stdin);
// listen for the "keypress" event
process.stdin.on('keypress', function (ch, key) {
if (key && key.ctrl && key.name == 'c') {
process.exit(0);
}
if ( key ){
switch ( key.name ){
case 'up':
console.log(' => Up: ');
motor1Fwd.on()
motor2Rev.on()
break;
case 'down':
motor2Fwd.on();
motor1Rev.on();
break;
case 'left':
motor1Fwd.off()
motor2Rev.on()
console.log(' => Left: ');
break;
case 'right':
motor1Fwd.on()
motor2Rev.off()
console.log('right');
break;
case 'space':
console.log(' => Stoping...');
motor1Fwd.off();
motor2Fwd.off();
motor1Rev.off();
motor2Rev.off();
break;
default:
console.log('Ignoring key: ' + key.name);
}
}
});
process.stdin.setRawMode(true);
process.stdin.resume();
});
viernes, 13 de junio de 2014
Instalar smartgit en ubuntu
1993 sudo add-apt-repository ppa:eugenesan/ppa
1994 sudo apt-get update
1995 sudo apt-get install smartgit
1996 sudo apt-get install smartgithg
viernes, 6 de junio de 2014
Uso de GIT y github
Instalar GIT
cesar@developerWEB:/var/www$ sudo apt-get install git
cesar@developerWEB:/var/www$ sudo apt-get install git-core
Configuramos las variables
cesar@developerWEB:/var/www$ git config --global user.name 'Cesar Morones Sanchez'
cesar@developerWEB:/var/www$ git config --global user.email 'cesar.morones1@gmail.com'
Generamos un par de llaves
cesar@developerWEB:/var/www$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cesar/.ssh/id_rsa):
/home/cesar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/cesar/.ssh/id_rsa.
Your public key has been saved in /home/cesar/.ssh/id_rsa.pub.
The key fingerprint is:
34:51:aa:47:d2:02:74:d1:7c:dc:5d:bb:32:69:1a:f4 cesar@developerWEB
The key's randomart image is:
+--[ RSA 2048]----+
| .o o+.o.. . ..|
| o .ooo . . .|
| o *. . . |
| * .. . . .|
| . S . E . |
| . + o |
| . |
| |
| |
+-----------------+
Una vez que tenemos la llave hay que ponerla en github en
Clonamos una carpeta de hithub a nuestra maquina
cesar@developerWEB:/var/www/clone$ sudo git clone https://github.com/cmorones/Sfotipy.git
[sudo] password for cesar:
Cloning into 'Sfotipy'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
checamos el status
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
nothing to commit (working directory clean)
Creamos dos archivos
cesar@developerWEB:/var/www/clone/Sfotipy$ touch hola.txt hola2.txt
checamos el sttaus y vemos que ya tenemos dos archivos nuevos
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# hola.txt
# hola2.txt
no changes added to commit (use "git add" and/or "git commit -a")
Los agregamos
cesar@developerWEB:/var/www/clone/Sfotipy$ git add --all
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README.md
# new file: hola.txt
# new file: hola2.txt
Con este comando desagregammos
cesar@developerWEB:/var/www/clone/Sfotipy$ git reset
Y le damos commit
#
cesar@developerWEB:/var/www/clone/Sfotipy$ git commit -m 'añadi dos archivos'
[master e3a7f8c] añadi dos archivos
0 files changed
mode change 100644 => 100755 README.md
create mode 100755 hola.txt
create mode 100755 hola2.txt
Este comando se usa solo la primera vez que hacemos un push y significa que vamos a subir los archivos a github
cesar@developerWEB:/var/www/clone/Sfotipy$ git push -u origin master
Username for 'https://github.com': cmorones
Password for 'https://cmorones@github.com':
To https://github.com/cmorones/Sfotipy.git
a2b33ad..e3a7f8c master -> master
Branch master set up to track remote branch master from origin.
cesar@developerWEB:/var/www$ sudo apt-get install git
cesar@developerWEB:/var/www$ sudo apt-get install git-core
Configuramos las variables
cesar@developerWEB:/var/www$ git config --global user.name 'Cesar Morones Sanchez'
cesar@developerWEB:/var/www$ git config --global user.email 'cesar.morones1@gmail.com'
Generamos un par de llaves
cesar@developerWEB:/var/www$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cesar/.ssh/id_rsa):
/home/cesar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/cesar/.ssh/id_rsa.
Your public key has been saved in /home/cesar/.ssh/id_rsa.pub.
The key fingerprint is:
34:51:aa:47:d2:02:74:d1:7c:dc:5d:bb:32:69:1a:f4 cesar@developerWEB
The key's randomart image is:
+--[ RSA 2048]----+
| .o o+.o.. . ..|
| o .ooo . . .|
| o *. . . |
| * .. . . .|
| . S . E . |
| . + o |
| . |
| |
| |
+-----------------+
Una vez que tenemos la llave hay que ponerla en github en
Clonamos una carpeta de hithub a nuestra maquina
cesar@developerWEB:/var/www/clone$ sudo git clone https://github.com/cmorones/Sfotipy.git
[sudo] password for cesar:
Cloning into 'Sfotipy'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
checamos el status
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
nothing to commit (working directory clean)
Creamos dos archivos
cesar@developerWEB:/var/www/clone/Sfotipy$ touch hola.txt hola2.txt
checamos el sttaus y vemos que ya tenemos dos archivos nuevos
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# hola.txt
# hola2.txt
no changes added to commit (use "git add" and/or "git commit -a")
Los agregamos
cesar@developerWEB:/var/www/clone/Sfotipy$ git add --all
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README.md
# new file: hola.txt
# new file: hola2.txt
Con este comando desagregammos
cesar@developerWEB:/var/www/clone/Sfotipy$ git reset
Y le damos commit
#
cesar@developerWEB:/var/www/clone/Sfotipy$ git commit -m 'añadi dos archivos'
[master e3a7f8c] añadi dos archivos
0 files changed
mode change 100644 => 100755 README.md
create mode 100755 hola.txt
create mode 100755 hola2.txt
Este comando se usa solo la primera vez que hacemos un push y significa que vamos a subir los archivos a github
cesar@developerWEB:/var/www/clone/Sfotipy$ git push -u origin master
Username for 'https://github.com': cmorones
Password for 'https://cmorones@github.com':
To https://github.com/cmorones/Sfotipy.git
a2b33ad..e3a7f8c master -> master
Branch master set up to track remote branch master from origin.
Suscribirse a:
Entradas (Atom)
