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 | |
/* | |
========== HTTP SOCKET EXAMPLE ============== | |
Автор: Fedcomp | |
https://github.com/Fedcomp/socket_example/ | |
Связка из скрипта и плагина показывающая | |
как связаться из amxx плагина с php скриптом | |
и как этому скрипту обработать запрос |
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 php | |
<?php | |
/* | |
========== Psychostats GeoIP updater ============== | |
Автор: Fedcomp | |
Для работы необходимо php расширение для работы ZIP. | |
php_zip.dll для windows. | |
Простой скрипт для обновления IP адресов стран в базе данных psychostats. | |
*/ |
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
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 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 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 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 |
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
require 'exception_notification/rails' | |
# Capture errors in production and return nil | |
module Failsafe | |
def failsafe(&_block) | |
yield | |
rescue => e | |
# Show errors only during development | |
if Rails.env.test? || Rails.env.development? | |
raise e |
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 | |
//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 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
mkdir %appdata%\Carbon\.debug\replay | |
mkdir %appdata%\Carbon\Airmech\.debug\replay | |
mkdir %appdata%\Carbon\AirmechCanary\.debug\replay | |
mkdir %appdata%\Carbon\AirmechSteam\.debug\replay |
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
require 'pathname' | |
require 'digest' | |
Pathname.new(Dir.pwd).children.select(&:file?).each do |file| | |
next if file.basename.to_s.start_with?('hashed_') || file.extname == '.rb' | |
file_md5 = Digest::MD5.file(file).hexdigest | |
old_name = file.basename | |
new_name = "hashed_#{file_md5}_#{old_name}" | |
puts "#{old_name} -> #{new_name}" | |
File.rename old_name, new_name |
OlderNewer