Skip to content

Instantly share code, notes, and snippets.

View ivanrosolen's full-sized avatar
:octocat:
....

Ivan Rosolen ivanrosolen

:octocat:
....
  • Stone
  • São Paulo, Brasil
View GitHub Profile
@ivanrosolen
ivanrosolen / db.sql
Created June 1, 2016 15:26
Use column names as select fields in another mysql query
SELECT group_concat(distinct column_name) as fields
FROM information_schema.columns
WHERE table_name='table_name' and column_name like 'text%' INTO @COLUMNS;
SET @s = CONCAT('SELECT ',@COLUMNS,' FROM table_name limit 10');
PREPARE stmt FROM @s;
EXECUTE stmt;
-- DEALLOCATE PREPARE stmt;
@ivanrosolen
ivanrosolen / sublime_plugins.txt
Last active May 28, 2021 20:24
Sublime Plugins
Sublime 4
--------------
set_ui theme
TrailingSpaces
Rainbow CSV
Sublime 3
--------------
SideBarEnhancements
BracketHighlighter
@ivanrosolen
ivanrosolen / php.ini
Created June 13, 2016 12:36
PHP.ini confi for xdebug/vagrant/sublime
zend_extension="/usr/lib/php/20151012/xdebug.so"
xdebug.default_enable = 1
xdebug.idekey = "vagrant"
xdebug.remote_enable = 1
xdebug.remote_autostart = 0
xdebug.remote_port = 9000
xdebug.remote_handler=dbgp
xdebug.remote_log="/var/log/xdebug/xdebug.log"
xdebug.remote_host=10.0.2.2 ; IDE-Environments IP, from vagrant box.
xdebug.show_local_vars=1
@ivanrosolen
ivanrosolen / apache_request_headers.php
Created June 14, 2016 18:02
apache_request_headers
<?php
if( !function_exists('apache_request_headers') ) {
function apache_request_headers() {
$arh = array();
$rx_http = '/\AHTTP_/';
foreach($_SERVER as $key => $val) {
if( preg_match($rx_http, $key) ) {
$arh_key = preg_replace($rx_http, '', $key);
$rx_matches = array();
// do some nasty string manipulations to restore the original letter case
@ivanrosolen
ivanrosolen / zshrc
Created July 12, 2016 19:23
oh-my-zsh profile
alias dockerup="docker-machine start default && eval \$(docker-machine env default)"
# Fix numeric keypad
# 0 . Enter
bindkey -s "^[Op" "0"
bindkey -s "^[On" "."
bindkey -s "^[OM" "^M"
# 1 2 3
bindkey -s "^[Oq" "1"
bindkey -s "^[Or" "2"
@ivanrosolen
ivanrosolen / country
Last active April 21, 2018 13:27
Country List
This list obtained from
http://www.umass.edu/microbio/rasmol/country-.txt
AD Andorra
AE United Arab Emirates
AF Afghanistan
AG Antigua and Barbuda
AI Anguilla
AL Albania
AM Armenia
@ivanrosolen
ivanrosolen / motd.sh
Last active August 31, 2016 10:17
fortune | cowsay | lolcat
#!/bin/bash
imgs=("blowfish" "bong" "bud-frogs" "bunny" "cheese" "cower" "daemon" "default" "dragon" "dragon-and-cow" "elephant" "elephant-in-snake" "eyes" "flaming-sheep" "ghostbusters" "head-in" "hellokitty" "kiss" "kitty" "koala" "kosh" "luke-koala" "meow" "milk" "moofasa" "moose" "mutilated" "ren" "satanic" "sheep" "skeleton" "small" "sodomized" "stegosaurus" "stimpy" "supermilker" "surgery" "telebears" "three-eyes" "turkey" "turtle" "tux" "udder" "vader")
count=${#imgs[@]}
rand=$[ $RANDOM % $count ]
eval "fortune | cowsay -n -f ${imgs[$rand]} | lolcat"
@ivanrosolen
ivanrosolen / branches.sh
Created September 12, 2016 12:25
Download all git branches
git branch -a | grep -v HEAD | perl -ne 'chomp($_); s|^\*?\s*||; if (m|(.+)/(.+)| && not $d{$2}) {print qq(git branch --track $2 $1/$2\n)} else {$d{$_}=1}' | csh -xfs
@ivanrosolen
ivanrosolen / Frond End.txt
Last active December 28, 2016 13:41
Frond End
FRONTEND PLENO
Atividades:
- Desenvolver Single Page Applications
- Desenvolver um sistema interativo e com qualidade.
- Escrever um código limpo e que funcione em todos os browsers.
- Seguir todas as recomendações dos guias de código.
- Desenvolvimento voltado a usabilidade.
- Garantir que o sistema tenha alto desempenho.
- Criar as funcionalidades de acordo com as requisições do cliente.
@ivanrosolen
ivanrosolen / rename_regex.sh
Created November 22, 2016 20:14
Rename file using regex
#!/bin/bash
for filename in *.jpg; do
newFilename=$(echo $filename | \
sed -E 's#^.+_(.+).jpg$#\1.jpg#')
mv "$filename" new/"$newFilename"
done