Skip to content

Instantly share code, notes, and snippets.

View cesc1989's full-sized avatar
🐻
¿Cuál es la diferencia entre la participación y el compromiso?

Francisco Quintero cesc1989

🐻
¿Cuál es la diferencia entre la participación y el compromiso?
View GitHub Profile
@cesc1989
cesc1989 / connect_to_database_and_query.php
Last active April 5, 2017 03:05
conect to a database and query it to return data in json format
<?php
$numero_cedula = $_GET['cedula'];
//CONEXION A LA BASE DE DATOS
$username = "root";
$password = "root";
$hostname = "localhost";
@cesc1989
cesc1989 / update_multiple_rows.php
Last active December 1, 2018 16:13
conectarse a la base de datos y actualizar varias filas mediante ciclo for
<?php
//CONEXION A LA BASE DE DATOS
$username = "root";
$password = "root";
$hostname = "localhost";
$link = mysql_connect($hostname, $username, $password);
if (!$link) {
die('Could not connect: ' . mysql_error());
}
@cesc1989
cesc1989 / apache_subdomain.conf
Last active April 5, 2017 03:05
Correctly setup subdomain in apache conf file
<VirtualHost *:80>
# Admin email, Server Name (domain name), and any aliases
ServerAdmin user@mail.com
ServerName sub.domain.com
ServerAlias www.sub.domain.com
# Index file and Document Root (where the public files are located)
DirectoryIndex index.html index.php
DocumentRoot /var/www/subdomainfolder/public_html
# Log file locations
@cesc1989
cesc1989 / website-migration
Last active August 29, 2015 14:14
Bash script to migrate/update Drupal website from development environment to production
#!/bin/bash
# ESTE ARCHIVO TIENE POR PROPOSITO FACILITAR LA MIGRACION DE UN SITIO EN LOCAL
# A UN SITIO ANDANDO EN LINODE. SOLO PARA EL CASO DE ACTUALIZACIONES
#DECLARACIÓN DE VARIABLES NECESARIAS
greentext="\033[32m"
bold="\033[1m"
normal="\033[0m"
bkpdate=$(date +"%Y%m%d%s")
@cesc1989
cesc1989 / Vagrantfile
Last active January 29, 2016 19:32
Provisioning Dev Stack. Provision a normal Linux machine or a Vagrant Ubuntu-based box.
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty32"
config.vm.network 'forwarded_port', guest: 3000, host: 3000
config.vm.provision 'shell', path: 'install_software.sh'
@cesc1989
cesc1989 / update-url.sql
Last active December 1, 2018 16:11
Consulta SQL para cambiar las urls por defecto de una instalación de WordPress cuando se mueve de servidor
UPDATE wp_options
SET option_value = 'http://yourdomain.com/'
WHERE option_name = 'siteurl';
UPDATE wp_options
SET option_value = 'http://yourdomain.com/'
WHERE option_name = 'home';
/* Más información:
https://otroespacioblog.wordpress.com/2014/12/10/la-solucion-definitiva-al-error-de-las-cookies-en-wordpress
@cesc1989
cesc1989 / .htaccess
Created May 26, 2015 14:56
Configuración del .htaccess para los Permalinks en WordPress
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
@cesc1989
cesc1989 / deploy_puma.rb
Last active March 12, 2019 14:02
Deploy with capistrano
# Change these
set :repo_url, '[ENTER YOUR GIT REPO URL HERE]'
set :user, 'macsa'
set :branch, 'test'
set :application, 'staging'
set :puma_threads, [4, 16]
set :puma_workers, 0
@cesc1989
cesc1989 / gh_automatic_login.sh
Last active June 17, 2020 19:34
Automaticly ssh-add the github ssh file to avoid typing the passphrase in every boot
#!/usr/bin/expect -f
spawn ssh-add /home/[USER]/.ssh/gh_rsa
expect "Enter passphrase for /home/[USER]/.ssh/gh_rsa:"
send "[PUT-PASSPHRASE HERE]\n";
interact
## Call with command
## expect gh_automatic_login.sh
#Found in:
@cesc1989
cesc1989 / bye_double.sh
Last active January 9, 2017 19:00
Find command to delete AppleDouble files and .DS_Store files
#!/bin/bash
find /path/to/folder -depth -name ".DS_Store" -exec rm {} \;
find /path/to/folder -depth -name "._*" -exec rm -Rf {} \;