Skip to content

Instantly share code, notes, and snippets.

View BenjaminGuV's full-sized avatar

Benjamín Guerrero BenjaminGuV

View GitHub Profile
@BenjaminGuV
BenjaminGuV / txt
Created July 2, 2017 16:21
Clonar base de datos
mysqldump -u {USERNAME} -p {DBCLON} > dump.sql
mysqladmin -u {USERNAME} -p create {NEWDB}
mysql -u {USERNAME} -p {NEWDB} < dump.sql
@BenjaminGuV
BenjaminGuV / iniciar-web.sh
Created December 30, 2016 03:49
iniciar web con sh para docker
#! /bin/sh
sudo service mysql start
sudo service apache2 start
<snippet>
<content><![CDATA[
<div class="form-group">
<label for="$1">$1</label>
<input type="text" class="form-control" id="$1" placeholder="">
</div>
]]></content>
<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
<tabTrigger>sinput</tabTrigger>
<!-- Optional: Set a scope to limit where the snippet will trigger -->
@BenjaminGuV
BenjaminGuV / ejecutar.bat
Created December 5, 2012 16:52
Ejecutar bat de python
@echo off
start python C:\test\test.py
exit
@BenjaminGuV
BenjaminGuV / excelmasivo
Created November 27, 2012 03:29
Copiar masivamente una hoja de calculo
Sub Macro2()
Dim x As Integer
x = InputBox("Enter number of times to copy Sheet1")
For numtimes = 1 To x
'Loop by using x as the index number to make x number copies.
'Replace "Sheet1" with the name of the sheet to be copied.
ActiveWorkbook.Sheets("1").Copy _
After:=ActiveWorkbook.Sheets("1")
@BenjaminGuV
BenjaminGuV / clonesPhp.php
Created July 18, 2012 23:27
Crear clones en php
<?php
$directorios = array( '****', '***' );
$dir = $_SERVER['DOCUMENT_ROOT'];
$direccion = $dir . rtrim(dirname($_SERVER['PHP_SELF'] ) );
$direccion = preg_replace('/\/\//', '/', $direccion) . "/";
function full_copy( $source, $target ) {
if ( is_dir( $source ) ) {
@mkdir( $target );
@BenjaminGuV
BenjaminGuV / crearArchivos.php
Created July 18, 2012 23:18
crear archivos multiples
<?php
$dir = $_SERVER['DOCUMENT_ROOT'];
?>
<html>
<head>
<title></title>
</head>
<body>
@BenjaminGuV
BenjaminGuV / enviarPOST.py
Created July 18, 2012 23:12
Envio de post por python
import httplib, urllib
parametros = urllib.urlencode({'campo1': 'valor uno', 'campo2' : 'valor dos'})
cabeceras = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
abrir_conexion = httplib.HTTPConnection("localhost:80")
abrir_conexion.request("POST", "/python/testConsulta.php", parametros, cabeceras)
respuesta = abrir_conexion.getresponse()
@BenjaminGuV
BenjaminGuV / cambiar-imagenes.php
Created June 25, 2012 23:34
cambiar de tamaño las imagenes
<?php
$destino = "/var/www/Guardar/";
$destino2 = "/Guardar/";
$filetype = $_FILES['file']['type'];
$type = substr($filetype, (strpos($filetype,"/"))+1);
$types=array("jpeg","gif","png", "jpg");
if(in_array($type, $types)){
if(isset($_FILES['file'])){
@BenjaminGuV
BenjaminGuV / FTP.class.php
Created June 15, 2012 10:41
Clase FTP en php
<?php
/**
* clase de FTP
*/
class Ftp
{
private $server;