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
import xml.etree.ElementTree as ET | |
import re, sys | |
def round_to_ten(number): | |
num=int(re.sub("[^0-9]", "", number)) | |
if num < 10: | |
return 5 | |
else: | |
return (num // 10) * 10 |
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
:global botToken "" | |
:global chatId "" | |
:global interfaceName "ether1" | |
while ([/ping 8.8.8.8 interval=3 count=1]=0) do={ | |
delay 5 | |
}; | |
/tool fetch url=("https://api.telegram.org/bot".$botToken."/sendMessage\?chat_id=".$chatId."&text=#".[/system identity get name]."+".[/ip address get [find interface=$interfaceName] address]) |
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
:global discordWebhookUrl "https://discordapp.com/api/webhooks/..." | |
:global interfaceName "ether1" | |
:while ([/ping 8.8.8.8 interval=3 count=1] = 0) do={ | |
:delay 5 | |
} | |
/tool fetch url=($discordWebhookUrl . "?wait=true") http-method=post http-data=("content=" . "#".[/system identity get name]."+" . [/ip address get [find interface=$interfaceName] address]) |
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
<?php | |
/* | |
Plugin Name: udpu folder tree | |
Plugin URI: # | |
Description: для додавання використайте: [udpu_folder_tree path=""] | |
Author: Tgu | |
Version: 1.0.0 | |
Author URI: # | |
*/ |
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
<?php | |
public function action(Create|Update)(){ | |
// ... | |
// ajax | |
}else if($model->load($request->post()) && !$model->validate()) { | |
return ['title'=>'Помилка','content'=>json_encode($model->getErrors(),JSON_UNESCAPED_UNICODE),'footer'=> Html::button(Yii::t('app', 'Закрити'),['class'=>'btn btn-default pull-left','data-dismiss'=>"modal"])]; | |
}else{ | |
// no ajax | |
}else if($model->load($request->post()) && !$model->validate()) { | |
die(json_encode($model->getErrors(),JSON_UNESCAPED_UNICODE)); |
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
<?php | |
//wordpress | |
if (file_exists('wp-config.php')) { | |
preg_match_all('/define\s*\(\s*[\'"](.*?)[\'"]\s*,\s*[\'"](.*?)[\'"]\s*\)\s*;/', file_get_contents('wp-config.php'), $matches, PREG_SET_ORDER); | |
foreach ($matches as $match) { | |
if(in_array($match[1],['DB_HOST','DB_USER','DB_PASSWORD','DB_NAME'],false)){ | |
define($match[1], $match[2]); | |
} |
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
<?php | |
// Параметри для підключення до MySQL серверу | |
$servername = "127.0.0.1"; | |
$username = ""; | |
$password = ""; | |
error_reporting(E_DEBUG); | |
ini_set('display_errors', 'on'); |
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 -x | |
for app in iptables ip6tables; do | |
if [[ $app =~ 6 ]]; then | |
index=6 | |
else | |
index=4 | |
fi | |
for chain in $($app -t filter -L -v -n | grep Chain | awk '{print $2}'); do | |
for id in $($app -t filter -L --line-numbers -n -Z $chain | egrep "\:(443|80)" | awk '{print $1}' | sort -r); do |
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 -x | |
firewall-cmd --zone=public --remove-service=http --permanent | |
firewall-cmd --zone=public --remove-service=https --permanent | |
for ipv in v4 v6; do | |
for i in $(firewall-cmd --zone=public --list-all | grep http | grep "ip${ipv}" | awk '{print $4}' | awk -F '"' '{print $2}' | sort -u); do | |
firewall-cmd --zone=public --permanent --remove-rich-rule "rule family="ip${ipv}" source address="$i" service name="http" accept" | |
firewall-cmd --zone=public --permanent --remove-rich-rule "rule family="ip${ipv}" source address="$i" service name="https" accept" | |
firewall-cmd --zone=public --permanent --remove-rich-rule "rule family="ip${ipv}" source address="$i" port port="80" protocol="tcp" accept" |
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
<?php | |
$query->andFilterWhere(['OR', ['is', $key, new \yii\db\Expression('null')], ['<=','LENGTH('.$key.')',0]])->all(); |
NewerOlder