Skip to content

Instantly share code, notes, and snippets.

View diegoulloao's full-sized avatar
👾
creative mode

Diego Ulloa diegoulloao

👾
creative mode
View GitHub Profile
@diegoulloao
diegoulloao / ip.txt
Last active August 19, 2021 15:14
Agrega alias para obtener IP Pública desde macOS Terminal
cd $HOME && echo "alias 'ip'='IP=\`dig +short myip.opendns.com @resolver1.opendns.com\` && echo \$IP && echo \$IP | pbcopy'" >> .bash_profile
@diegoulloao
diegoulloao / fix-wp-shortcodes.php
Last active January 17, 2019 06:44
Agrega filtro que elimina saltos de línea y párrafos en blancos entre shortcodes en wordpress.
<?php
// Elimina saltos de líneas y párrafos vacíos entre shortcodes.
function wp_fix_shortcodes( $content ){
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']'
);
@diegoulloao
diegoulloao / mysql-docker.sh
Created April 16, 2019 23:49 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@diegoulloao
diegoulloao / bash-get-url-status-code.sh
Last active April 20, 2019 02:36
Obtiene status de request a URL vía http.
#!/bin/sh
STATUS_CODE=`curl -s -o /dev/null -I -w "%{http_code}" "[URL]"`
@diegoulloao
diegoulloao / get-script-dir.sh
Created April 21, 2019 01:35
Get current script called directory no matter where called.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
# from https://stackoverflow.com/questions/59895/get-the-source-directory-of-a-bash-script-from-within-the-script-itself
@diegoulloao
diegoulloao / git-io-custom-url.md
Created October 10, 2019 22:43 — forked from dikiaap/git-io-custom-url.md
git.io custom URL

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
  • https://*.github.com/*
  • https://*.github.io
@diegoulloao
diegoulloao / so-info.sh
Created October 18, 2019 02:28
Returns SO info (generic in all linux distributions)
# linux
cat /etc/os-release
# unix
uname
# Darwin: MacOS
# Linux: Linux
@diegoulloao
diegoulloao / Photos-React+Typescript+JSDocs+MaterialUI.js
Last active February 7, 2020 07:09
Photos component in React vs. Svelte
/**
*
* Photos React TSX Component
* @module ./components/Photos.tsx
*
*/
import React from 'react'
@diegoulloao
diegoulloao / .vimrc
Last active October 29, 2022 03:39
My vim conf
" __ __ _____ _____ ____ _ ______ _____
" \ \ / /\ | __ \|_ _| /\ | _ \| | | ____|/ ____|
" \ \ / / \ | |__) | | | / \ | |_) | | | |__ | (___
" \ \/ / /\ \ | _ / | | / /\ \ | _ <| | | __| \___ \
" \ / ____ \| | \ \ _| |_ / ____ \| |_) | |____| |____ ____) |
" \/_/ \_\_| \_\_____/_/ \_\____/|______|______|_____/
let theme="farout"
" theme list: gruvbox|ayu|pop-punk|fahrenheit|farout
@diegoulloao
diegoulloao / fibonacci.js
Last active March 19, 2022 03:27
Fibonacci with generator functions
// 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
const fibonacci = function* () {
let n1 = 0
let n2 = 1
yield n1
yield n2
while (true) {