This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// assumes variable data, which is a homogenous collection of objects | |
// get keys | |
var keys = _.keys(data[0]); | |
// convert to csv string | |
var csv = keys.join(","); | |
_(data).each(function(row) { | |
csv += "\n"; | |
csv += _(keys).map(function(k) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
varnishlog -q '(RespStatus ~ 500 or RespStatus ~ 502 or RespStatus ~ 503)' -i "ReqURL" -I "ReqHeader:Host:" -I "RespHeader:Location:" -i "RespStatus" -I "ReqHeader:Referer:" -a -w /var/log/varnish/varnishlog-errors-500.log -D | |
varnishncsa -F '%h %l %u %t "%r" %s %b "%{Referer}i" "%{User-agent}i" "%{Cookie}i" "%{Varnish:hitmiss}x" "%{Varnish:time_firstbyte}x"' -a -w /var/log/varnish/cached-miss.log -D | |
varnishncsa -q '(RespStatus ~ 500 or RespStatus ~ 502 or RespStatus ~ 503)' -a -w /var/log/varnish/varnishncsa-errors-500.log -D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# filter by request host header | |
varnishlog -q 'ReqHeader ~ "Host: example.com"' | |
# filter by request url | |
varnishlog -q 'ReqURL ~ "^/some/path/"' | |
# filter by client ip (behind reverse proxy) | |
varnishlog -q 'ReqHeader ~ "X-Real-IP: .*123.123.123.123"' | |
# filter by request host header and show request url and referrer header |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE customer_entity | |
SET password_hash = CONCAT(SHA2('xxxxxxxxSUASENHAAQUI', 256), ':xxxxxxxx:1') | |
WHERE email = 'EMAILDOALOMBADO'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# can remove them: | |
find / -type f -name ".certbot.lock" -exec rm {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-14-04 | |
# Download the Let’s Encrypt Client | |
cd /usr/local/sbin | |
sudo wget https://dl.eff.org/certbot-auto | |
sudo chmod a+x /usr/local/sbin/certbot-auto | |
# Set Up the SSL Certificate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo 'enable aux swap composer' | |
$ fallocate -l 2G /swapfile-composer | |
$ chmod 600 /swapfile-composer | |
$ mkswap /swapfile-composer | |
$ swapon /swapfile-composer | |
$ echo '/swapfile-composer none swap sw 0 0' | sudo tee -a /etc/fstab | |
$ echo 'disable aux swap composer' | |
$ swapoff /swapfile-composer | |
$ rm /swapfile-composer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# folder projects my PC | |
WWW=${HOME}/html/ | |
# all projects | |
folder=$(ls -Alr ${WWW} | grep ^d | awk -F" " '{print $9}') | |
file_version=$(date +"%Y%m%d-%H%M") | |
for project in $folder | |
do | |
# folder repo project | |
DIR=${WWW}${project} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# - create access in rabbitmq | |
echo "write name User Rabbit" | |
read user_rabbit | |
echo "write password User Rabbit" | |
read -s password_rabbit | |
sudo rabbitmqctl add_user ${user_rabbit} ${password_rabbit} && | |
sudo rabbitmqctl set_user_tags ${user_rabbit} administrator && | |
sudo rabbitmqctl set_permissions -p / ${user_rabbit} ".*" ".*" ".*" |
NewerOlder