Skip to content

Instantly share code, notes, and snippets.

View wiltonbsilva's full-sized avatar

Wilton Bastos Silva wiltonbsilva

View GitHub Profile
## verifies if a service is running. If not, starts the service.
service_search_string=Tardis
function start(){
# code to start your service =)
}
function check(){
ps -ef | grep $service_search_string | grep -v grep
@wiltonbsilva
wiltonbsilva / sicp. scm
Created June 21, 2014 14:36
sicp notes
(define (square x)
(* x x))
(define (sum-squares x y)
(+ (square x) (square y)))
(define (test-square)
(= 144 (square 12)))
(define (test-sum-squares)
@wiltonbsilva
wiltonbsilva / domain-regex
Last active August 13, 2018 17:55
Regular Expression to match simple domain names
RegEx:
^(\.?[a-z0-9]{3,9}(\.?[a-z]{2,3})*)$
Test:
www.google.com
Test:
www.google.com.br
Test:
radio.uol.com.br
@wiltonbsilva
wiltonbsilva / cep-regex
Created June 14, 2014 14:16
Regular Expression to match Brazilian zipcodes (CEP)
RegEx:
(\d{5})-?(\d{3})
Test:
09930-360
Test:
09930360
Test:
09930 777
@wiltonbsilva
wiltonbsilva / cpf-regex
Created June 14, 2014 12:26
Regular Expression to match a Brazilian CPF (similar to an SSN)
RegEx:
^([-\.\s]?(\d{3})){3}[-\.\s]?(\d{2})$
Test:
345.753.428-40
Test:
345.753.422.99
Test:
123-543-667.54
Test:
@wiltonbsilva
wiltonbsilva / monetary-values-regex
Created June 14, 2014 10:30
Regular Expression to match monetary values
RegEx:
^(\d{1,3})+(\.\d{3})*(,\d{2})$
Test:
10.000.234,07
Test:
12,89
Test:
3.765,35
Test:
@wiltonbsilva
wiltonbsilva / phone-number-regex
Created June 14, 2014 10:26
Regular Expression to match Brazilian (cell)?phone numbers
RegEx:
(^|\()?\s*(\d{2})\s*(\s|\))*(9?\d{4})(\s|-)?(\d{4})($|\n)
Test:
11957375429
Test:
11 976546863
11 976542345
11 97654 9753
(11) 98765 1234
@wiltonbsilva
wiltonbsilva / install-play.sh
Created June 3, 2014 19:27
Shell script to install the Play Framework
cd ~/Downloads/
wget http://downloads.typesafe.com/play/2.2.3/play-2.2.3.zip?_ga=1.165836478.1853295521.1400617207
unzip -e ~/Downloads/play-2.2.3.zip?_ga=1.165836478.1853295521.1400617207
sudo mkdir -p /opt/scala/play/
sudo mv ~/Downloads/play-2.2.3 /opt/scala/play/