Skip to content

Instantly share code, notes, and snippets.

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

Ivan Rosolen ivanrosolen

:octocat:
....
View GitHub Profile
@ivanrosolen
ivanrosolen / Get URI var js
Created October 19, 2015 19:01
Get URI var js
function getVar(name){
if(name=(new RegExp('[?&]'+encodeURIComponent(name)+'=([^&]*)')).exec(location.search))
return decodeURIComponent(name[1]);
}
var recoverHash = getVar('hash');
@ivanrosolen
ivanrosolen / regex josn
Created October 27, 2015 17:27
Regex Json
function syntaxHighlight(json) {
if (typeof json != 'string') {
json = JSON.stringify(json, undefined, 2);
}
json = json.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
var cls = 'number';
if (/^"/.test(match)) {
if (/:$/.test(match)) {
cls = 'key';
@ivanrosolen
ivanrosolen / Converters
Last active October 28, 2015 20:54
Converters
// Extrair textos do PDF
pdftotext -layout file.pdf output.txt
// Extrair textos do PDF em um arquivo HTML
pdftotext -htmlmeta -layout file.pdf output.html
// Extrair imagens de um PDF
pdfimages file.pdf images/
// Converter imagens PPM para JPG
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"detect_indentation": true,
"draw_white_space": "all",
"font_size": 12,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
@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
@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 / 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 / Remove DS_Store
Created March 11, 2016 17:23
Remove DS_Store
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
@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 / 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