Skip to content

Instantly share code, notes, and snippets.

#/bin/bash
# change the mac
wan1="eth1.2"
wan2="eth1"
/sbin/ifconfig $wan1 down
/sbin/ifconfig $wan2 down
@rcg4u
rcg4u / curlStreamedDownload.php
Created January 19, 2022 16:19 — forked from lmammino/curlStreamedDownload.php
Download a large file (streaming) with php and curl extension
<?php
$url = 'http://www.example.com/a-large-file.zip';
$path = '/path/to/a-large-file.zip';
$fp = fopen($path, 'w');
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FILE, $fp);
$data = curl_exec($ch);
#apache security headers
<IfModule mod_headers.c>
Header set X-Content-Type-Options nosniff
Header set Strict-Transport-Security "max-age=31536000;"
Header set Referrer-Policy "same-origin"
Header set Feature-Policy "accelerometer 'none' ; ambient-light-sensor 'none' ; autoplay 'none' ; camera 'none' ; encrypted-media 'none' ; fullscreen 'none' ; geolocation 'none' ; gyroscope 'none' ; magnetometer 'none' ;microphone 'none' ; midi 'none' ; payment 'none' ; speaker 'none' ; sync-xhr 'none' ; usb 'none' ; notifications 'none' ; vibrate 'none' ; push 'none' ; vr 'none' "
Header set Content-Security-Policy: "script-src 'self'"
Header always append X-Frame-Options SAMEORIGIN
Header set X-XSS-Protection "1; mode=block"
</IfModule>
@rcg4u
rcg4u / disable-comments.sh
Created November 16, 2020 03:53 — forked from jplhomer/disable-comments.sh
Disable all comments/pings in WordPress with WP-CLI
$ wp post list --format=ids | xargs wp post update --comment_status=closed
# Output:
# Success: Updated post 2514.
# Success: Updated post 2511.
# Success: Updated post 2504.
# Success: Updated post 2499.
# Success: Updated post 2441.
# etc...
@rcg4u
rcg4u / gist:6e40e2738d24472e033f99203bcaee81
Created June 1, 2019 19:47
this is from Sridhar Katakam, this allows seopress to read Oxygen builder content. Get code snippets and add as a function.
add_filter( 'seopress_content_analysis_content', 'sp_content_analysis_content', 10, 2 );
/**
* Filter the analyzed content to add content from Oxygen editor.
* @param string $content Current content in the WordPress editor.
* @param int $id ID of the current entry.
* @return string Modified content.
*/
function sp_content_analysis_content( $content, $id ) {
// HTML of Oxygen's content.
{"agency_base_standard_classes":{"standard_class_group":[{"group_name":"Breakpoints (Reference Only)","classes":[{"class":"s","description":"Mobile (up to 480px)"},{"class":"m","description":"Mobile (up to 768px)"},{"class":"l","description":"Tablet (up to 992px)"},{"class":"xl","description":"Small Desktop (up to 1400px)"}]},{"group_name":"Columns - Gaps & Grow","classes":[{"class":"c-columns-gap-s","description":"Small columns gap"},{"class":"c-columns-gap-m","description":"Medium columns gap"},{"class":"c-columns-gap-l","description":"Large columns gap"},{"class":"c-columns-gap-xl","description":"Extra large columns gap"},{"class":"c-columns-gap-xxl","description":"Extra-extra large columns gap"},{"class":"c-column-grow","description":"Grow column to second column"},{"class":"c-row-grow","description":"Grow column to second row"}]},{"group_name":"Columns - Desktop","classes":[{"class":"c-columns-6"},{"class":"c-columns-5"},{"class":"c-columns-4"},{"class":"c-columns-3"},{"class":"c-columns-2"},{"class":"c-
@rcg4u
rcg4u / openwrt-lede-openvpn-client.md
Created September 8, 2019 18:43 — forked from braian87b/openwrt-lede-openvpn-client.md
Setting an OpenWrt / LEDE Based Router as OpenVPN Client

These instructions should work for Streisand as well for others VPN providers (Streisand is a Software that automatically configures a VPS online server with OpenVPN and other VPN/Proxy Softwares in order to have a private VPN Server)

These instructions are for getting an OpenWrt Based Router working as OpenVPN Client (should work for LEDE, Gargoyle and another distributions). Computers connected to Lan Ports of the OpenWrt Router will navigate through the Internet connection of the OpenVPN Server (in this case the Streisand one previously set up) you need a working Router with OpenWrt based firmware flashed on it (LEDE or eko.one.pl could also work) steps works well on Chaos Calmer 15.05 or 15.05.1.

  1. You need to telnet 192.168.1.1 (OpenWrt Router) and set up a password using passwd You can skip this if you already have a password and can connect using ssh.
<?php
/**
* Hook: woocommerce_before_main_content.
*
* @hooked woocommerce_output_content_wrapper - 10 (outputs opening divs for the content)
* @hooked woocommerce_breadcrumb - 20
* @hooked WC_Structured_Data::generate_website_data() - 30
*/
@rcg4u
rcg4u / w3-total-cache-sitemap-exclusions
Created March 20, 2019 16:16 — forked from htpcBeginner/w3-total-cache-sitemap-exclusions
W3 Total Cache exclusions for sitemaps. Use this under Page Cache (Never cache the following items), Minify (Never minify the following items), Browser Cache (404 Error Exception List), and CDN (Rejected Files) for Yoast or any XML sitemaps for WordPress.
([a-z0-9_\-]+)?sitemap(_index)?(-)?([0-9]*)?\.(xml(\.gz)?|xsl)$
@rcg4u
rcg4u / Contract Killer 3.md
Created October 14, 2018 03:40 — forked from malarkey/Contract Killer 3.md
The latest version of my ‘killer contract’ for web designers and developers

Contract Killer

The popular open-source contract for web professionals by Stuff & Nonsense

  • Originally published: 23rd December 2008
  • Revised date: March 15th 2016
  • Original post