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 get_web_page( $url ){ | |
| $options = array( | |
| CURLOPT_RETURNTRANSFER => true, // return web page | |
| CURLOPT_HEADER => false, // don't return headers | |
| CURLOPT_FOLLOWLOCATION => true, // follow redirects | |
| CURLOPT_ENCODING => "", // handle all encodings | |
| CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17", // who am i | |
| CURLOPT_AUTOREFERER => true, // set referer on redirect |
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 | |
| //echo 'Я знаю '.declOfNum(5, array('иностранный язык', 'иностранных языка', 'иностранных языков')); | |
| function declOfNum($number, $titles) | |
| { | |
| $cases = array (2, 0, 1, 1, 1, 2); | |
| return $number." ".$titles[ ($number%100>4 && $number%100<20)? 2 : $cases[min($number%10, 5)] ]; | |
| } | |
| function seconds_to_words($seconds) { | |
| if ($seconds < 0) return "Неизвестно"; |
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 | |
| /* | |
| ========== HTTP SOCKET EXAMPLE ============== | |
| Автор: Fedcomp | |
| https://github.com/Fedcomp/socket_example/ | |
| Связка из скрипта и плагина показывающая | |
| как связаться из amxx плагина с php скриптом | |
| и как этому скрипту обработать запрос |
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
| #!/usr/bin/env php | |
| <?php | |
| /* | |
| ========== Psychostats GeoIP updater ============== | |
| Автор: Fedcomp | |
| Для работы необходимо php расширение для работы ZIP. | |
| php_zip.dll для windows. | |
| Простой скрипт для обновления IP адресов стран в базе данных psychostats. | |
| */ |
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
| var curr_domain = window.location.href.split('//')[1].split('/')[0]; | |
| var outside_links = []; | |
| var links = document.getElementsByTagName("a"); | |
| for(var i=0; i<links.length; i++) { | |
| var res = links[i].href.split('//')[1]; | |
| if(typeof res == 'undefined') continue; | |
| if(res.split('/')[0] == curr_domain) continue; | |
| outside_links.push('http://' + res); | |
| } |
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
| source "https://rubygems.org" | |
| gem 'taps', git: 'git://github.com/eric1234/taps.git', branch: 'patch-1' | |
| gem 'mysql2' | |
| gem 'sqlite3' | |
| gem 'pg' | |
| gem 'rack','1.0.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
| #!/usr/bin/env bash | |
| BUILD_REGEX="phantomjs-[0-9\.]+-linux-x86_64" | |
| PHANTOM_VERSION=$(curl -s phantomjs.org/download.html | grep -oE $BUILD_REGEX | head -n 1) | |
| PHANTOM_FILENAME="$PHANTOM_VERSION.tar.bz2" | |
| PHANTOM_URL="https://bitbucket.org/ariya/phantomjs/downloads/$PHANTOM_FILENAME" | |
| curl -L $PHANTOM_URL | \ | |
| tar xjf - -C /usr/local/bin --strip-components 2 $PHANTOM_VERSION/bin/phantomjs |
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
| #!/usr/bin/env php | |
| <?php | |
| $filename = "ip.list"; | |
| $prefix = "2a04:5200:8"; | |
| $ips_amount = null; | |
| if(isset($argv[1])){ | |
| $ips_amount = (int) $argv[1]; | |
| } else { | |
| $ips_amount = 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
| <?php | |
| $filename = "ip.list"; | |
| $prefix = "2a04:5200:8"; | |
| function generate_ipv6($prefix){ | |
| function generate_ipv6_block() { | |
| $seed = str_split('1234567890abcdef'); | |
| shuffle($seed); | |
| $block = join("", $seed); // Symbol array to string | |
| $block = substr($block, 0, 4); |
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
| def save_post_card | |
| binding.pry | |
| card = PostCard.where(:id => params[:post_card_id]).first | |
| if card.nil? | |
| render text: 'Nnot found postcard with provided ID', status: 404 | |
| return | |
| end | |
| text_data = params[:text_data] | |
| name = params[:name].strip |
OlderNewer