Skip to content

Instantly share code, notes, and snippets.

View viniciusdaniel's full-sized avatar

Vinicius Daniel Antunes Oliveira viniciusdaniel

View GitHub Profile
@viniciusdaniel
viniciusdaniel / emberjs.md
Created May 4, 2017 18:15
emberjs javascript frontend spa single app application

RewriteCond

Voce deve usar a diretiva RewriteCond para adicionar condições para aplicar ou não o redirecionamento.

Por exemplo:

# Redirect when we have a single parameterRewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-dRewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?mod=$1

Neste caso, as flags !-f e !-d estão determinando que o redirect só ocorrera se não existir arquivo ou pasta com a url correspondente.

@viniciusdaniel
viniciusdaniel / bash-cheatsheet.sh
Created February 23, 2017 19:19 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@viniciusdaniel
viniciusdaniel / 51-android.rules
Created January 30, 2017 14:13
Install Android Tools: ADB Fastboot on Ubuntu Linux
# /etc/udev/rules.d/51-android.rules
# udev rule to detect android devices
# These rules refer to http://developer.android.com/tools/device.html
# Acer
SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0666", GROUP="plugdev"
# Archos
SUBSYSTEM=="usb", ATTR{idVendor}=="0e79", MODE="0666", GROUP="plugdev"
# Asus
SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0666", GROUP="plugdev"
@viniciusdaniel
viniciusdaniel / match.sh
Last active February 19, 2018 20:48
Regexp matches string and return only matched or group
# String matcher for shell
# author: Vinícius Daniel Antunes Oliveira <viniciusdaniel@gmail.com>
# license: MIT <https://opensource.org/licenses/MIT>
#
#!/bin/bash
# Usage:
# cat /tmp/file | match.sh <regexp> [group match]
# match.sh <filename> <regexp> [group match]
# match.sh <string> <regexp> [group match]
#
ADOBE Creative Suite 5 Master Collection
1023-1631-3275-3276-0087-5426
1325-1576-4130-9475-8280-4266
1325-1548-7004-9142-5077-1912
1325-1684-1405-3432-6260-7438
1325-1238-0019-6636-5160-2146
1325-1966-4532-5397-9277-9204
@viniciusdaniel
viniciusdaniel / generate-new-debug-keystore.sh
Last active January 13, 2016 20:47
Re-generate a debug.keystore file with defaults passwords and common name data, using SHA-2 and size of 2048bits
# If ~/.android/debug.keystore exists you need remove this previosly
keytool -genkey -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android -keysize 2048 -keyalg RSA -sigalg SHA256withRSA -validity 30000 -dname "CN=Android Debug,O=Android,C=US"
@viniciusdaniel
viniciusdaniel / d3js.pt-br.js
Created October 29, 2014 23:01
D3.js localize pt-BR for time and number formatting
/**
* Configuração de localização em Português do Brasil(PT-BR) para o D3.js realizar formatação tempo e números
* Mais detalhes conferir a documentação: https://github.com/mbostock/d3/wiki/Time-Formatting
*/
var localized = d3.locale({
"decimal": ",",
"thousands": ".",
"grouping": [3],
"currency": ["R$", ""],
@viniciusdaniel
viniciusdaniel / log_rotate
Created May 17, 2013 21:16
Exemplo de script de log rotate com script pos rotate
/omnilogic/retailcore/shared/log/*.log {
daily
missingok
rotate 0
compress
delaycompress
notifempty
copytruncate
sharedscripts
postrotate
@viniciusdaniel
viniciusdaniel / resque.rake
Created July 31, 2012 04:11 — forked from denmarkin/resque.rake
My rake task for clearing Resque queues and stats
# see http://stackoverflow.com/questions/5880962/how-to-destroy-jobs-enqueued-by-resque-workers - old version
# see https://github.com/defunkt/resque/issues/49
# see http://redis.io/commands - new commands
namespace :resque do
desc "Clear pending tasks"
task :clear => :environment do
queues = Resque.queues
queues.each do |queue_name|
puts "Clearing #{queue_name}..."