Skip to content

Instantly share code, notes, and snippets.

View danielnunez's full-sized avatar
:octocat:
Codeando eternamente

Daniel Nuñez S. danielnunez

:octocat:
Codeando eternamente
View GitHub Profile
@danielnunez
danielnunez / gist:0dc5f8e58e5dc5c4b040
Created December 10, 2015 19:22
Largo máximo de VARCHAR en MySQL
Los valores en las columnas VARCHAR cadenas de longitud variable.
La longitud puede ser especificado como un valor de 0 a 255 antes
de MySQL 5.0.3, y de 0 a 65.535 en 5.0.3 y versiones posteriores.
El efectivo máximo de la longitud de un VARCHAR en MySQL 5.0.3 y
luego está sujeta a que el tamaño máximo de fila (65.535 bytes,
el cual es compartido entre todas las columnas) y el conjunto de
caracteres utilizado.
Uso TEXT tipos.
Los cuatro tipos de TEXTO son TINYTEXT, TEXT, MEDIUMTEXT, y LONGTEXT.
@danielnunez
danielnunez / setup-single.sh
Created April 27, 2017 05:08 — forked from eamexicano/setup-single.sh
Inicializa repositorio de git. Lo envia vía ssh a un nuevo repositorio vacío y sincroniza con htdocs. Necesita el nombre del repo, usuario y modificar las rutas.
#!/bin/bash
SITIO="$1"
USUARIO="$2"
PUERTO="22"
REPOSITORIO_REMOTO="/var/repo/$SITIO"
SHEBANG="#!/bin/bash"
SITIO_HTDOCS="/var/www/$SITIO"
read -r -d '' HOOK <<EOF
${SHEBANG}
CREATE TABLE "City" (
id integer NOT NULL,
name text,
region_id integer
);
INSERT INTO "City" (id, name, region_id) VALUES (15101, 'Arica', 15);
INSERT INTO "City" (id, name, region_id) VALUES (15102, 'Camarones', 15);
INSERT INTO "City" (id, name, region_id) VALUES (15201, 'Putre', 15);
INSERT INTO "City" (id, name, region_id) VALUES (15202, 'General Lagos', 15);
@danielnunez
danielnunez / odbc_setup_macos.md
Created May 30, 2019 18:50 — forked from arvsrao/odbc_setup_macos.md
Guide to accessing MS SQL Server in Mac OS X via PyODBC

Since I spent essentially two full days figuring out how to access a corporate MS SQL database pythonicly, I figured I should leave some notes, for future reference and to aid other souls looking to do the same.

These instructions and the commands that follow, were executed on a MAC OS 10.8.3 system. Additionally, I found this blog [post][1] especially helpful during the debugging process.

On mac os, there is a default ODBC manager, iODBC. Other Unix based systems tend to use [unixODBC][2]. Look elsewhere for a discussion about the differences between these driver managers. The only feature we care about is being able to connect to SQL databases through [pyodbc][3], and at the time of this writing [pyodbc][3] requires iODBC as its manager.

Start by installing freeTDS libraries. FreeTDS allows unix programs to talk natively with MS SQL and SyBase databases.

brew intsall freetds
@danielnunez
danielnunez / docker-raspberry.md
Created May 26, 2020 04:18 — forked from pablokbs/docker-raspberry.md
Docker en raspberry
version: '2'
services:
node1:
image: mariadb:10.1
environment:
- TERM=xterm
- MYSQL_ROOT_PASSWORD=admin
- MYSQL_INITDB_SKIP_TZINFO=1
volumes:
- ~/Dev/docker/compose/galera/conf.d:/etc/mysql/conf.d
@danielnunez
danielnunez / AutoHotkey.ahk
Created October 26, 2020 19:59 — forked from eduardoarandah/AutoHotkey.ahk
Cómo usar Acentos y Ñ en teclado inglés con AutoHotkey
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Caracteres en español usando CapsLock
; Presionar CapsLock mas la vocal para acentuarla
; Para la ñ se puede usar la n o la tecla ; (porque ahí estaba la ñ originalmente)
; Para la ¿ usamos CapsLock y la tecla que tiene actualmente el ?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; mapear la n como ñ
CapsLock & n::
If GetKeyState("Shift", "P")
@danielnunez
danielnunez / imagick3.4.4-PHP7.4-forge.sh
Created October 29, 2020 03:40 — forked from danielstgt/imagick3.4.4-PHP7.4-forge.sh
Install ImageMagick / Imagick 3.4.4 on PHP 7.4 server (Laravel Forge)
#!/bin/bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
apt-get install pkg-config libmagickwand-dev -y
cd /tmp
wget https://pecl.php.net/get/imagick-3.4.4.tgz
tar xvzf imagick-3.4.4.tgz
@danielnunez
danielnunez / index.js
Created April 14, 2021 18:10 — forked from imedadel/index.js
An example of using React Hooks with jQuery and Chosen plugin. `Chosen` is the original example using a class and `Chosed` is the "modern" approach using functions and hooks.
const Chosed = (props) => {
const elmt = React.useRef()
React.useLayoutEffect(()=>{
const $elmt = $(elmt.current)
const handleChange = (e) => {
props.onChange(e.target.value);
}
$elmt.chosen()
@danielnunez
danielnunez / minio-letsencrypt.sh
Created June 1, 2021 23:41 — forked from superseb/minio-letsencrypt.sh
Minio using Let's Encrypt certbot obtained certificates
#!/bin/bash
if [ "$#" -ne 2 ]; then
echo "Usage: $0 fqdn email"
exit 1
fi
docker run -p 80:80 -p 443:443 -v /etc/letsencrypt:/etc/letsencrypt certbot/certbot certonly --standalone --agree-tos --reinstall --force-renewal --non-interactive --text --rsa-key-size 4096 --email $2 --domains $1
mkdir -p /root/.minio/certs
cp /etc/letsencrypt/live/$1/fullchain.pem /root/.minio/certs/public.crt