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 get_socket_socks5(proxy_host, proxy_port, proxy_username, proxy_password, host, port): | |
sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM) | |
sock.connect((proxy_host,proxy_port)) | |
fd = sock.makefile() | |
sock.send("\x05\x01\x02") | |
server_status = sock.recv(8192) | |
if server_status != "\x05\x02": | |
return False | |
sock.send(struct.pack('B', 0x01) + struct.pack('B', len(proxy_username)) + proxy_username + struct.pack('B', len(proxy_password)) + proxy_password) | |
server_buffer = sock.recv(8192) |
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 | |
error_reporting( E_ALL ); | |
ini_set( 'display_errors', true ); | |
if ( !headers_sent() ) { | |
header( 'X-Accel-Buffering: no' ); | |
} | |
function is_apache2() { |
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 | |
function my_prefix_wp_editor_set_quality( $quality, $mime_type ) { | |
if ( $mime_type === 'image/jpeg' ) { | |
$quality = 90; | |
} elseif ( $mime_type === 'image/png' ) { | |
$quality = 91; | |
} elseif ( $mime_type === 'image/gif' ) { | |
$quality = 92; | |
} else { |
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 | |
function my_prefix_jpeg_quality( $quality, $context ) { | |
return 90; | |
} | |
add_filter( 'jpeg_quality', 'my_prefix_jpeg_quality', 10, 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
<script type="text/javascript"> | |
function hasTouchEvent() { | |
try { | |
document.createEvent("TouchEvent"); | |
return true; | |
} catch(e) { | |
return false; | |
} | |
} | |
if (hasTouchEvent()) { |
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 | |
function ipadd( $ip, $add ) { | |
if ( ( $long = ip2long( $ip ) ) === false ) { | |
return false; | |
} | |
return long2ip( $long + $add ); | |
} | |
$old_ip = '198.162.0.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
<IfModule mod_php5.c> | |
php_value memory_limit 512M | |
</IfModule> | |
<IfModule mod_php7.c> | |
php_value memory_limit 512M | |
</IfModule> |
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 | |
function count_chars_delimiter( string $str, string $delimiter = ',' ) { | |
$arr = []; | |
foreach ( array_filter( array_map( 'trim', explode( $delimiter, $str ) ), function( $v ) { return ( $v !== '' ); } ) as $value ) { | |
$arr[$value] = isset( $arr[$value] ) ? $arr[$value] : 0; | |
$arr[$value]++; | |
} | |
return $arr; | |
} |
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 | |
function remove_scripts_with_src( $html ) { | |
$use_errors = libxml_use_internal_errors( true ); | |
$dom = new \DOMDocument(); | |
$dom->loadHTML( $html ); | |
$scripts = $dom->getElementsByTagName( 'script' ); | |
for ( $i = $scripts->length - 1; $i >= 0; $i-- ) { | |
if ( !( $item = $scripts->item( $i ) ) ) { | |
continue; |
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 | |
function replace_scripts_with_src( $html ) { | |
$html = preg_replace( '`\<script\b[^\x3e]*\bsrc\b[\x00-\x20\x7f]*\=[\x00-\x20\x7f]*(?:[\x22](?:[^\x22]*)[\x22]|[\x27](?:[^\x27]*)[\x27]|[^\x20\x3e]*)[^\x3c]*(?:(?!\<\/script\>)\<[^\x3c]*)*\<\/script\>`i', '', $html ); | |
return $html; | |
} | |
$old_html = file_get_contents( 'https://www.facebook.com' ); | |
$new_html = replace_scripts_with_src( $old_html ); |
OlderNewer