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 / 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 / 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 / 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 / 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 / opencertiface_ubuntu.sh
Created May 30, 2016 14:50
Opencertiface Ubuntu
apt-get update
apt-get install libtool bison byacc flex autoconf libssl-dev openssl qt5-default build-essential cmake libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev build-essential checkinstall cmake pkg-config yasm libtiff4-dev libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev unzip git wget vim
mkdir gsoap
cd gsoap
wget http://downloads.sourceforge.net/project/gsoap2/gSOAP/gsoap_2.8.29.zip?r=&ts=1459146537&use_mirror=ufpr
unzip gsoap_2.8.29.zip?r=
cd gsoap-2.8/
./configure
@ivanrosolen
ivanrosolen / Remove DS_Store
Created March 11, 2016 17:23
Remove DS_Store
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
$ find . -iname ".DS_Store" -exec rm -f {} \;
@ivanrosolen
ivanrosolen / Remove DS_Store
Created March 11, 2016 17:23
Remove DS_Store
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
@ivanrosolen
ivanrosolen / lol.sh
Created January 12, 2016 19:59
Pegar apenas um número do output (multiline) de um comando
Output:
lero lero
lero lero
bla bla bla (ASSET ID: 85) time 12
comando 2>&1 | sed -E 's,.+: ([0-9]+)\).+,\1,g' | tail -n1
Resultado:
85
@ivanrosolen
ivanrosolen / check_filesize.sh
Created January 6, 2016 14:17
get file files from csv
#!/bin/bash
touch file_sizes.csv
OLDIFS=$IFS
IFS=";"
FILE_SIZES="file_sizes.csv"
RIGHT_SIZE="0"
while read ID FILE PATH SIZE
@ivanrosolen
ivanrosolen / check.sh
Created January 4, 2016 13:24
check.sh
#!/bin/bash
result=`ps aux | grep -i "/path/file.php args" | grep -v "grep" | wc -l`
if [ $result -eq 0 ]
then
php /path/file.php args >> /path/file.log &
fi