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
<?php | |
function parse_cbu_exchange(){ | |
$data = []; | |
$html = @file_get_contents('https://cbu.uz/oz/arkhiv-kursov-valyut/'); | |
preg_match( "/<table class=\"table table-lined table_currency\">(.*?)<\/table>/isu" , $html , $matches); | |
if (!empty($matches[0])) { | |
preg_match_all("/<tr>(.*?)<\/tr>/isu", $matches[0], $tr); | |
if(!empty($tr[0])){ | |
foreach ($tr[0] as $t) { |
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 | |
for (( i=0; i <= 1000; ++i )) | |
do | |
tmpfile=$(mktemp /tmp/fake/abc-script.XXXXXXXXXXXXXXXXXXXXXXXXXX) | |
dd if=/dev/urandom of=$tmpfile bs=1M count=$(expr 1 + $RANDOM % 3) | |
done |
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
<?php | |
$token = "TOKEN"; //Telegram bot token | |
$chats = ['12345', '12345']; //Array of telegram chats to send a message | |
function send_request( $content = [] ){ | |
$url = "https://api.telegram.org/bot{$GLOBALS['token']}/sendMessage"; | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_HEADER, false); |
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
<?php | |
function pre( &$y ) { | |
$y = $y + 1; | |
return $y; | |
} | |
function post( &$y ) { | |
$old = $y; | |
$y = $y + 1; |
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
if (typeof String.prototype.parseFunction != 'function') { | |
String.prototype.parseFunction = function () { | |
var funcReg = /function *\(([^()]*)\)[ \n\t]*{(.*)}/gmi; | |
var match = funcReg.exec(this.replace(/\n/g, ' ')); | |
if(match) { | |
return new Function(match[1].split(','), match[2]); | |
} | |
return null; |
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
<?php | |
function write_file( $path, $data, $mode = 'wb') { | |
if ( ! $fp = @fopen( $path, $mode ) ) return FALSE; | |
flock( $fp, LOCK_EX ); | |
for ( $result = $written = 0, $length = strlen( $data ); $written < $length; $written += $result ) { | |
if ( ( $result = fwrite( $fp, substr( $data, $written ) ) ) === FALSE ) break; | |
} |
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
yyyy-mm-dd: /^((((19|[2-9]\d)\d{2})\-(0[13578]|1[02])\-(0[1-9]|[12]\d|3[01]))|(((19|[2-9]\d)\d{2})\-(0[13456789]|1[012])\-(0[1-9]|[12]\d|30))|(((19|[2-9]\d)\d{2})\-02\-(0[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))\-02\-29))$/g | |
yyyy/mm/dd: /^((((19|[2-9]\d)\d{2})\/(0[13578]|1[02])\/(0[1-9]|[12]\d|3[01]))|(((19|[2-9]\d)\d{2})\/(0[13456789]|1[012])\/(0[1-9]|[12]\d|30))|(((19|[2-9]\d)\d{2})\/02\/(0[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))\/02\/29))$/g | |
mm-dd-yyyy: /^(((0[13578]|1[02])\-(0[1-9]|[12]\d|3[01])\-((19|[2-9]\d)\d{2}))|((0[13456789]|1[012])\-(0[1-9]|[12]\d|30)\-((19|[2-9]\d)\d{2}))|(02\-(0[1-9]|1\d|2[0-8])\-((19|[2-9]\d)\d{2}))|(02\-29\-((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$/g | |
mm/dd/yyyy: /^(((0[13578]|1[02])\/(0[1-9]|[12]\d|3[01])\/((19|[2-9]\d)\d{2}))|((0[13456789]|1[012])\/(0[1-9]|[12]\d|30)\/((19|[2-9]\d)\d{2}))|(02\/(0[1-9]|1\d|2[0-8]) |
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
<?php | |
function check_tasix( $ip ){ | |
$range = @file_get_contents('tasix.json'); | |
$range = json_decode($range, TRUE); | |
if( !is_array( $range ) ) return false; | |
ksort( $range ); | |
$ip2long = ip2long( $ip ); | |
if( $ip2long !== false ) { |
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 | |
username="root" #ssh uchun foydalanuvchi | |
ssh_key_path="/home/$USER/.ssh/id_rsa.pub" #ssh kalit | |
# serverlar ro'yxati | |
servers=( | |
server1.domain.uz | |
server2.domain.uz | |
server3.domain.uz |
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
<?php | |
function findArrayWithLevenshtein( $input, $dic ) { | |
$minDistance = PHP_INT_MAX; | |
$correctedWord = $input; | |
foreach ( $dic as $key => $value ) { | |
$distance = levenshtein( $input, $key ); | |
if ( $distance < $minDistance ) { | |
$minDistance = $distance; |