Skip to content

Instantly share code, notes, and snippets.

@mcastelino
mcastelino / tc mirroring.md
Last active October 19, 2024 15:35
Using tc redirect to connect a virtual machine to a container network

Connecting a veth device to tap

  • veth device from CNI/CNM plugin: eth0
  • tap device that connects to the VM: tap0

Redirecting traffic between the two devices

tc qdisc add dev eth0 ingress
tc filter add dev eth0 parent ffff: protocol all u32 match u8 0 0 action mirred egress redirect dev tap0
@jacobdubail
jacobdubail / php
Created January 30, 2017 23:44
Function to auto-set your ACF5 Pro license key
function jtd_acf_auto_set_license_keys() {
if ( !get_option('acf_pro_license') && defined('ACF_5_KEY') ) {
$save = array(
'key' => ACF_5_KEY,
'url' => home_url()
);
$save = maybe_serialize($save);
@sorah
sorah / zabbix2idobata.sh
Created March 27, 2014 19:52
zabbix -> idobata
# Set the following script to "Actions -> Operations -> Remote command (target: current host, execute on: zabbix server)"
# http://img.sorah.jp/z-20140328-045035.png
# ruby is required
bash <<'EOF'
YOUR_ZABBIX_DOMAIN="zabbix"
IDOBATA_HOOK="http://idobata.io/hooks/XXX"
LABEL="$(ruby -e'puts %w(default inverse warning important important important)[ARGV[0].to_i]' -- {TRIGGER.NSEVERITY})"
[ "_{TRIGGER.STATUS}" = "_OK" ] && LABEL="success"
@wokamoto
wokamoto / replace-siteurl.php
Created September 4, 2012 23:22
WordPress のDB上のサイトURLを一気に変換
#!/usr/bin/php
<?php
switch($argc) {
case 1:
case 2:
echo "please input new site url and wp directory name!\n";
exit();
default:
$old_site = isset($argv[3]) ? $argv[3] : '';
$path = $argv[2];