Skip to content

Instantly share code, notes, and snippets.

View audriusrudalevicius's full-sized avatar

Audrius audriusrudalevicius

View GitHub Profile
if(INSTR({string_or_var}, '-'), (REPLACE( SUBSTRING( SUBSTRING_INDEX( {string_or_var}, '-', 1 ) ,
LENGTH( SUBSTRING_INDEX( {string_or_var}, {string_or_var}, 1 -1 ) ) +1 ) , '-', '' )), '')
if(INSTR({string_or_var}, '-'), (REPLACE( SUBSTRING( SUBSTRING_INDEX( {string_or_var}, '-', 2 ) ,
LENGTH( SUBSTRING_INDEX( {string_or_var}, {string_or_var}, 2 -1 ) ) +1 ) , '-', '' )), '')
#!/bin/sh
SCRIPT="#!/bin/sh
if [ \${1} == \"--help\" ]; then
/opt/sublime_text/sublime_text --help
else
/opt/sublime_text/sublime_text
fi
"
#!/bin/sh
sudo su -c 'echo -e "ka 01 01\r\n" > /dev/ttyUSB0'
sleep 15
sudo su -c 'echo -e "kf 01 07\r\n" > /dev/ttyUSB0'
sleep 1
sudo su -c 'echo -e "kb 01 09\r\n" > /dev/ttyUSB0'
sleep 1
sudo su -c 'echo -e "mc 01 0E\r\n" > /dev/ttyUSB0'
alias ports='lsof -i -n -P' # view programs using an internet connection
alias portstats='sudo netstat -s' # show statistics for all ports
alias tcpstats='sudo netstat -st' # show statistics for tcp ports
alias tcp_='sudo netstat -atp' # list all TCP ports
alias tcp_trace='pkt_trace tcp' # to show all TCP packets
alias udpstats='sudo netstat -su' # show statistics for udp ports
alias udp='sudo netstat -aup' # list all UDP ports
alias udp_trace='pkt_trace udp' # to show all UDP packets
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default
function map() {
emit(1, {
sum: this.value, // the field you want stats for
min: this.value,
max: this.value,
count: 1,
diff: 0
});
}
@audriusrudalevicius
audriusrudalevicius / pedantically_commented_playbook.yml
Last active August 28, 2015 23:04 — forked from marktheunissen/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
update:
bin/manager --copy-configs
composer install
npm install
bower install
git ls-files --others --exclude-standard | grep db-evolutions | xargs -i '{}' rm {} || true
bin/manager -c # clear cache
bin/manager --drop-all-tables
bin/manager -m # run migrations
bin/manager --doctrine-fixture-load
[
"Algeria", "Iran", "Belarus", "Romania", "Philippines", "Philippines", "Spain",
"Spain", "Cameroon", "Brazil", "Iraq", "Philippines", "Myanmar", "Philippines",
"India", "Pakistan", "Pakistan", "Argentina", "Ethiopia", "India", "Romania",
"China", "Somalia", "China", "China", "China", "United States", "Azerbaijan",
"Russia", "Russia", "India", "Turkey", "Indonesia", "Philippines", "India",
"Moldova", "United States", "India", "Mali", "Cameroon", "Indonesia", "Iran",
"Turkey", "Indonesia", "India", "Thailand", "Central African Republic", "Egypt",
"Egypt", "Bosnia and Herzegovina", "Indonesia", "Gambia", "India", "China", "China",
"China", "China", "Spain", "Algeria", "India", "Belarus", "Brazil", "Venezuela",
[
{"city" : "Bab Ezzouar", "country":"Algeria"},
{"city" : "Babol", "country":"Iran"},
{"city" : "Babruysk", "country":"Belarus"},
{"city" : "Bacău", "country":"Romania"},
{"city" : "Bacolod", "country":"Philippines"},
{"city" : "Bacoor", "country":"Philippines"},
{"city" : "Badajoz", "country":"Spain"},
{"city" : "Badalona", "country":"Spain"},
{"city" : "Bafoussam", "country":"Cameroon"},