This file contains hidden or 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
import requests | |
import sys | |
def telegram_bot_sendtext(bot_message): | |
bot_token = '***' | |
bot_chatID = '***' | |
api_url = 'https://api.telegram.org/bot' + bot_token + '/sendMessage' | |
data = {'chat_id': bot_chatID, 'text': bot_message} |
This file contains hidden or 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/sh | |
IPS=$(cat /opt/var/log/asterisk/messages | grep -oE "failed for '([^:]*)" | grep -oE '[0-9]+\.[0-9]+\.[0-9+]+\.[0-9]+' | sort | uniq) | |
[ -z "$IPS" ] && exit 0 | |
for ip in ${IPS} | |
do | |
echo "Blocking IP: ${ip}" | |
iptables -I INPUT -s ${ip} -j DROP | |
echo "iptables -I INPUT -s ${ip} -j DROP" >> /jffs/scripts/firewall-start |
This file contains hidden or 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
curl -XPUT localhost:9200/_cluster/settings -H 'Content-type: application/json' --data-binary $'{"transient":{"cluster.max_shards_per_node":20000}}' |
This file contains hidden or 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
phpspy -p 25109 -b 40960 | /usr/local/src/phpspy/stackcollapse-phpspy.pl | /usr/local/src/phpspy/vendor/flamegraph.pl > flame.svg |
This file contains hidden or 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 materialized view to store all price list prices as MD5 hash | |
CREATE MATERIALIZED VIEW prices AS select price_list_id, MD5(array_agg(pp.quantity::text || pp.unit_code || pp.value::text || pp.currency ORDER BY pp.quantity, pp.unit_code, pp.value::text, pp.currency)::text) as pmd5 FROM oro_price_product pp GROUP BY price_list_id; | |
-- Add index for md5 to improve performance | |
CREATE INDEX pmd5_idx ON prices(pmd5); | |
-- SELECT base price list, number of duplicated price lists and concatenated ids of duplicates | |
select p1.price_list_id, COUNT(p2.price_list_id), array_agg(p2.price_list_id ORDER BY p2.price_list_id) from prices p1 INNER JOIN prices p2 on p1.pmd5 = p2.pmd5 AND p1.price_list_id <> p2.price_list_id WHERE p1.price_list_id = (SELECT MIN(price_list_id) FROM prices WHERE p1.pmd5 = pmd5) GROUP BY p1.price_list_id ORDER BY p1.price_list_id; | |
-- SELECT overall number of unique price lists | |
SELECT COUNT(DISTINCT pmd5) from prices; | |
-- DROP VIEW | |
DROP MATERIALIZED VIEW prices; |
This file contains hidden or 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 | |
APP_CONSOLE="bin/console" | |
CONFIG_DIR="config" | |
ENV="" | |
if [[ $2 == 'test' ]] | |
then | |
ENV='_test' | |
fi |
This file contains hidden or 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 | |
currentDir=${PWD##*/} | |
repoDir=$(basename $(dirname $(dirname $(readlink -f .)))) | |
APP_HOST=$currentDir.$repoDir.loc | |
APP_CONSOLE="app/console" | |
INDEX="app_dev.php" | |
if [[ ! -f ${APP_CONSOLE} ]] | |
then |
This file contains hidden or 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
code | label-en_US | parent | |
---|---|---|---|
master | Master catalog | ||
cat_11 | Category 1.1 | master | |
cat_111 | Category 1.1.1 | cat_11 | |
cat_12 | Category 1.2 | master |
This file contains hidden or 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
<VirtualHost *:8080> | |
ServerName %HTTP_HOSTNAME% | |
SSLEngine on | |
SSLCertificateFile "%HTTP_SSL_CRT%" | |
SSLCertificateKeyFile "%HTTP_SSL_KEY%" | |
RewriteEngine On | |
RewriteCond %{HTTP:Connection} Upgrade [NC] | |
RewriteCond %{HTTP:Upgrade} websocket [NC] | |
RewriteRule .* ws://%WS_TARGET_IP%:8080%{REQUEST_URI} [P,L] | |
ProxyPreserveHost On |
This file contains hidden or 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
[ 0.000000] Booting Linux on physical CPU 0x500 | |
[ 0.000000] Linux version 4.12.0-rc6-The-Twelve-MyyQi+ (gamer@tachibana) (gcc version 5.4.0 (Gentoo 5.4.0 p1.0, pie-0.6.5) ) #3 SMP PREEMPT Tue Jun 20 03:38:14 UTC 2017 | |
[ 0.000000] CPU: ARMv7 Processor [410fc0d1] revision 1 (ARMv7), cr=10c5387d | |
[ 0.000000] CPU: div instructions available: patching division code | |
[ 0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache | |
[ 0.000000] OF: fdt: Machine model: Rockchip RK3288 Tinker Board | |
[ 0.000000] Memory policy: Data cache writealloc | |
[ 0.000000] On node 0 totalpages: 524288 | |
[ 0.000000] free_area_init_node: node 0, pgdat c13e1800, node_mem_map eeff9000 | |
[ 0.000000] Normal zone: 1536 pages used for memmap |