Skip to content

Instantly share code, notes, and snippets.

View humbertocastelo's full-sized avatar
🍓

Humberto Castelo Branco humbertocastelo

🍓
View GitHub Profile
@humbertocastelo
humbertocastelo / wp_editor_set_quality_and_jpeg_quality.php
Last active August 5, 2024 13:20
wp_editor_set_quality and jpeg_quality
<?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 {
<?php
error_reporting( E_ALL );
ini_set( 'display_errors', true );
if ( !headers_sent() ) {
header( 'X-Accel-Buffering: no' );
}
function is_apache2() {
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)