Skip to content

Instantly share code, notes, and snippets.

View marcialsoto's full-sized avatar

Marcial Soto Sánchez marcialsoto

View GitHub Profile
@marcialsoto
marcialsoto / Iniciar en git
Last active April 15, 2020 22:04
gitinit.md
## Instalar git
[Descargar](https://git-scm.com/downloads)
## Configurar git
```
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
```
@marcialsoto
marcialsoto / Centos7-VH
Created August 24, 2019 21:33
Centos 7 VirtualHost
# Crea directorio html
sudo mkdir -p /var/www/intranet.osinfor.gob.pe/html
# Crea logs dir
sudo mkdir -p /var/www/intranet.osinfor.gob.pe/log
# Next, assign ownership of the html directory with the $USER environmental variable:
sudo chown -R $USER:$USER /var/www/intranet.osinfor.gob.pe/html
# Make sure that your web root has the default permissions set:
@marcialsoto
marcialsoto / enable-cors-dotnet.txt
Created May 31, 2019 17:48
Enable CORS in .NET
Install-Package Microsoft.AspNet.WebApi.Cors
nableCorsAttribute cors = new EnableCorsAttribute("*", "*", "*");
config.EnableCors(cors);
@marcialsoto
marcialsoto / onbeforeunload.js
Created January 9, 2019 22:04
Use of onbeforeunload for prevent closing page
<script>
window.onbeforeunload = function (event) {
var message = 'Important: Please click on \'Save\' button to leave this page.';
if (typeof event == 'undefined') {
event = window.event;
}
if (event) {
event.returnValue = message;
sudo locale-gen es_ES es_ES.utf8
sudo dpkg-reconfigure locales
sudo update-locale LANG=es_ES.UTF-8
/etc/php/7.2/apache2/php.ini
date.timezone = America/Lima
#!/bin/sh
if [ "$1" -eq 72 ]; then
echo "Cambiando a PHP 7.2"
sudo a2dismod php5.6
sudo a2enmod php7.2
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php7.2
sudo update-alternatives --set phar /usr/bin/phar7.2
sudo update-alternatives --set phar.phar /usr/bin/phar.phar5.16
sudo mysql
use mysql;
UPDATE mysql.user SET plugin = "mysql_native_password" WHERE User="root";
UPDATE user SET authentication_string=PASSWORD("root") WHERE User="root";
flush privileges; exit
nano /path/to/create-sh.sh
#!/bin/bash
chmod +x /path/to/create-sh.sh
mv /path/to/create-sh.sh /usr/local/bin/create-sh
<?php
$mysqli = new mysqli("66.147.244.210", "incatra5_msoto", "#Hacker147*", "incatr$
//$mysqli = new mysqli("localhost", "minam", "minam", "educacion");
/* comprobar la conexión */
if ($mysqli->connect_errno) {
printf("Conexión fallida: %s\n", $mysqli->connect_error);
exit();
}
/* comprobar si el servidor sigue vivo */
@marcialsoto
marcialsoto / ajax.js
Created July 13, 2017 15:13
cors.php
$.ajax({
dataType : "text/plain",
contentType: "application/json;",
type: "post",
url: "http://172.16.8.22/AgroRuralMovil/SvcAsistencia.svc/ConsultaAsistencia",
data: {"cDni":"44069967","dFechaInicio":"2012-01-01","dFechaFin":"2017-07-04","iOpcion":1},
success: function(e){
console.log(e);
},
error: function(e){