Skip to content

Instantly share code, notes, and snippets.

View jasondewitt's full-sized avatar
:shipit:

Jason DeWitt jasondewitt

:shipit:
View GitHub Profile
@jasondewitt
jasondewitt / merge.sh
Created September 25, 2015 22:02
merge log files into a single file
#!/bin/sh
export MFILE=merge_file.txt
export SFILE=complete_file.txt
for file in `ls *.log`
do
cat $file >> $MFILE
@jasondewitt
jasondewitt / incapsula.sh
Last active May 4, 2016 20:33
update nginx to allow various cloud service IPs
#!/usr/bin/env bash
# incapsula.sh
# grab the list of pingdom check public ips and format into a nginx config file to allow
# these addresses
# also handles set_real_ip_from, include both files into your config and check
# http://nginx.org/en/docs/http/ngx_http_realip_module.html for more info on real ip
allow_file='/etc/nginx/include/incapsula.conf'
realip_file='/etc/nginx/include/incapsula_realip.conf'
@jasondewitt
jasondewitt / headers.php
Created May 9, 2016 21:58
dump all headers in php
<?php
if (!function_exists('getallheaders')) {
function getallheaders()
{
if (!is_array($_SERVER)) {
return array();
}
$headers = array();
@jasondewitt
jasondewitt / wptest.sh
Last active May 17, 2022 14:38
Install wptest.io via wp-cli
#!/bin/bash
echo "installing WP test content"
wp plugin install wordpress-importer --activate
curl -OL https://raw.githubusercontent.com/manovotny/wptest/master/wptest.xml
wp import wptest.xml --authors=create
wp plugin uninstall wordpress-importer --deactivate
rm wptest.xml
import sys
import locust
import gevent
from gevent.socket import socket
from gevent.queue import Queue
import time
from utils.bootstrap import test_conf as TEST_CONFIG
import insight
@jasondewitt
jasondewitt / gist:08c234697e3428738dbf69ae9c46bb31
Last active June 2, 2016 21:00
search and replace all http://domain.com occurrences with https://domain.com in a WP multisite install for all sites
for x in $(wp site list --fields=domain --format=csv);
do
if [ $x != 'domain' ];
then
wp search-replace http://$x https://$x --network --url=$x
fi
done
@jasondewitt
jasondewitt / moveusers.sh
Created October 20, 2016 20:46
migrate all users from one linux server to another
#!/usr/bin/env bash
targetsrv=user@ip.add.re.ss
for user in $(ssh $targetsrv ls /home)
do
if ! id $user > /dev/null 2>&1
then
echo "create user $user"
useradd -m -s /bin/bash $user
@jasondewitt
jasondewitt / kops_iam.txt
Created January 13, 2017 23:09
iam for kops user
Some notes from a new cluster with a manual IAM group and user:
Navigate to the IAM home page after logging onto the console
Click the Groups link on the left tab and then click Create New Group
Set Group Name: to kops and then click Next Step
Attach the following policies and then click Next Step:
AmazonEC2FullAccess
AmazonRoute53FullAccess
AmazonS3FullAccess
IAMFullAccess
@jasondewitt
jasondewitt / README.md
Created March 24, 2017 14:49 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed


### Keybase proof
I hereby claim:
* I am jasondewitt on github.
* I am jasondewitt (https://keybase.io/jasondewitt) on keybase.
* I have a public key ASBTUzl9HrHjwumj6v8pNIC2TpPAAoCJ0JJM6GrrZjqvuwo
To claim this, I am signing this object: