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
.idea |
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
while true; | |
do | |
ls -s $FILE; | |
sleep 1; | |
done | awk 'BEGIN{ previous=0;}{ current=$1; if(previous==0) previous=current; d=current-previous; previous=current; print 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
// | |
// Put this file inside your theme in folder js (js/email-confirm.js) | |
// | |
// First we add a hook to the form submit event | |
jQuery( document ).ready( function () { | |
jQuery('.wpcf7-submit').click(function () { | |
// We remove the error to avoid duplicate errors | |
jQuery('.error').remove(); | |
// We create a variable to store our error message | |
var errorMsg = jQuery('<span class="error">Your emails do not match.</span>'); |
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 sns_log_testing AS u | |
SET message = jsonb_set(t.message, '{type}', JSONB '"DEVICE_EVENT"') | |
FROM (SELECT * | |
FROM sns_log_testing AS s | |
WHERE s.message ->> 'type' = 'CLIENT_EVENT' | |
AND s.message ->> 'event_type' = 'NOTIF_REQUEST' | |
LIMIT 10000) AS t | |
WHERE t.id = u.id |
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
-- On the server. | |
-- \copy is run on the client side, so if you run in your local machine to connect to the remote | |
-- server, you will transfer the results probably in plain. So better run it on local. | |
\copy (Select * From sns_log where received > '2018-01-01') To '/tmp/log-20180101.csv' With CSV delimiter ',' | |
-- On the client side. | |
\COPY sns_log FROM 'log-20180101.csv' WITH delimiter as ',' csv |
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
#!/usr/bin/env bash | |
INTERFACE=eno16777984 | |
PORT=80 | |
tcpdump -i $INTERFACE -A -s 10240 'tcp port '$PORT' and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' \ | |
| egrep --line-buffered "^........(GET |HTTP\/|POST |HEAD )|^[A-Za-z0-9-]+: " \ | |
| sed -r 's/^........(GET |HTTP\/|POST |HEAD )/\n\1/g' |
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
#!/usr/bin/env bash | |
SERVER="http://elasticsearch.server.example.com:9200" | |
curl "$SERVER/_cat/indices?v" | awk '{ print $3}' | sort > /tmp/indexes.txt | |
while read -u 3 f; | |
do | |
echo $f | |
COMMAND="curl -XDELETE $SERVER/$f" |
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
# elasticsearch url | |
URL=https://smartnotifications-9383428543.eu-central-1.bonsaisearch.net | |
curl -s $URL/logstash-nginx-*/_count | sed -e 's/^.*"count":\([^,]*\),.*$/\1/' |
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 '{"count":"7363","_shards":{"total":1,"successful":1,"failed":0}}' | sed -e 's/^.*"count":"\([^"]*\)".*$/\1/' |
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 '{"count":7363,"_shards":{"total":1,"successful":1,"failed":0}}' | sed -e 's/^.*"count":\([^,]*\),.*$/\1/' |