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 | |
i_in=en0 | |
i_out=en1 | |
dport=1234 | |
dst=1.2.3.4 | |
src=4.3.2.1 | |
iptables -A FORWARD -i $i_in -o $i_out -p tcp --syn --dport $dport -m conntrack --ctstate NEW -j ACCEPT | |
iptables -A FORWARD -i $i_out -o $i_in -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT |
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 | |
/* | |
Plugin Name: Remove Dashboard Meta Boxes | |
Plugin URI: http://pmg.co/category/wordpress | |
Description: Removes the default dashboard widgets from the WordPress admin. | |
Author: Christopher Davis | |
Author URI: http://pmg.co/people/chris | |
License: GPL2 | |
*/ |
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 src="https://code.jquery.com/jquery-3.1.0.js"></script> | |
<script id="myScript" type="text/javascript"> | |
(function (){ | |
var excludeCountries = [ | |
'Russia' | |
] | |
var timeout = 10000 | |
var cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)no_ads\s*\=\s*([^;]*).*$)|^.*$/, '$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
#!/usr/bin/env bash | |
HOOK_URL="https://hooks.slack.com/services/XXX" | |
FILE="/etc/passwd" | |
MSG="Here is file content as preformatted text:"$'\n```\n'"$(< "$FILE")"$'\n```\n' | |
PAYLOAD="$(jq --raw-input --slurp '{text:.}' <<< "$MSG")" | |
curl \ | |
-X POST \ | |
-H 'Content-type: application/json' \ |
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
// example | |
const fetchUrl = fetchUrlFactory(2) | |
const { content, headers } = await fetchUrl('https://example.com') | |
// lib | |
const https = require('https') | |
function fetcUrlFactory ({ concurrency }) { | |
let running = 0 | |
let queue = [] |
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
aws s3 ls \ | |
| grep -e 'pr.*\.example\.com' \ | |
| cut -d ' ' -f 3 \ | |
| xargs -I {} -L 1 aws s3 rb s3://{} --force |
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 | |
set -e | |
SOURCE_APP=web-app | |
TARGET_APP=$1 | |
[ -z "$TARGET_APP" ] \ | |
&& echo "usage: `basename $0` <TARGET_APP>" \ | |
&& exit 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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>Dashboard Rotator</title> | |
<script> | |
var dashboardDisplayTimeout = 120000; | |
var dashboards = [{ | |
name: 'Tab1', | |
url: 'https://tab1.example.com' | |
}, { |
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
console.log('<RoutingRules>') | |
;[ | |
['/url1/', '/url2/'], | |
['/url11/', '/url22/'] | |
].forEach(([source, target]) => console.log(` | |
<RoutingRule> | |
<Condition> | |
<KeyPrefixEquals>${source}</KeyPrefixEquals> | |
</Condition> |
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
const got = require('got') | |
async function authenticate (endpoint, username, password) { | |
try { | |
const response = await got(endpoint, { | |
json: true, | |
body: { | |
username, | |
password | |
} |