Skip to content

Instantly share code, notes, and snippets.

@glennschler
glennschler / ora-ec2hosts
Created June 10, 2012 18:53
Removes old entries of local hostname from the hosts file since the REH EC2 image inserts a new entry every reboot
#! /bin/sh -x
#
# chkconfig: 2345 96 99
# description: removes old entries for this server name from the host file
# add then adds the correct hosts entry
#
hname=`hostname`
lev=`who -r`
echo "Called with ${1} hostname=${hname} ${lev}" | logger -t 'ora-ec2hosts'
@glennschler
glennschler / MyHTTPService.java
Created June 11, 2012 17:40
I use this OATS OpenScript technique for several advanced script control needs. This example only shows how to stop the "content length is zero" error, though this can be used as a template for any advanced control of virtual users.
package yourcompanyname.oats.scripting.modules.http.api;
import oracle.oats.scripting.modules.basic.api.exceptions.AbstractScriptException;
import oracle.oats.scripting.modules.http.api.HTTPService;
import oracle.oats.scripting.modules.http.api.HTTPService.EncodeOptions;
public class MyHTTPService extends HTTPService
{
private IteratingVUser m_vu = null;
@glennschler
glennschler / lsof
Last active December 11, 2015 16:58
format lsof output
lsof -i | grep -E "(LISTEN|ESTABLISHED)" | awk '{printf "%-15s\t%-6s\t%s\n", $1, $8, $9}'
i.e.:
Notes TCP 192.168.2.12:50482->17.158.8.77:imaps
firefox-b TCP 192.168.2.12:61090->gist.github.com:https
@glennschler
glennschler / nexus date fix.md
Last active December 19, 2015 09:49
Various Android Nexus command line
@glennschler
glennschler / sshServer2FA_OSX.md
Last active January 22, 2022 22:18
google-authenticator 2fa for os x
  1. Assuming xcode CLI tools already installed. If not, install here
xcode-select --install
  1. Assuming Homebrew. If not, install here
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@glennschler
glennschler / Setup OpenVPN.md
Last active March 5, 2023 00:13
Setup OpenVPN server running on Amazon ec2.

OpenVPN Technologies has provided their SSL VPN solution in a free virtual machine image that can be hosted in the Amazon cloud. This allows anyone to quickly setup their own VPN solution to provide secure internet access, or a secure network between local and remote locations. With Amazon EC2 the cost can be free for the first year, and then can cost less than one US cent ($.005) per hour depending on configuration and bandwidth needs. The OpenVPN license is free for the first two users.

The instructions given by OpenVPN are thorough and easy to follow. They also describe an optional step on how to setup an Amazon static IP address. For free tier or other users who will leave the instance running full-time there is zero cost for this static IP, but for users who plan to only run the VPN on an hourly basis there will be additional ip "reservation" cost for e

@glennschler
glennschler / Notes.md
Last active March 25, 2022 02:39
Raspberry Pi Notes

Notes

Install of Wheezy-Raspbian v2013-09-25

Configure Raspberry Pi from Mac OS X

  • Download Raspbian Raw image
  • From the OS X command line. Following these eLinux SD Card Setup. To summarize:
    • diskutil list
      • identify the disk (not partition) of your SD card. e.g. disk4 (not disk4s1)
    • diskutil unmountDisk /dev/<disk# from diskutil>
  • e.g. diskutil unmountDisk /dev/disk3
# redefine the tmux cmd to always prompt and re-attach to an old session,
# if no explicit session name given
tmux() {
  # if no arguments then check if there is any old sessions
  if [ $# -eq 0 ]; then
    t=$(which tmux)
    results=$($t list-sessions 2> /dev/null)
    if [[ -z $results ]]; then
 # start normal as the first session

For the Mac [some possible needed tools? try without]

brew update
brew install wget
brew install curl

Setup some directory structure

mkdir minecraft
@glennschler
glennschler / Block VNC ARD.md
Last active October 6, 2020 07:51
Firewall setting notes using PFCTL not IPFW on OS X

Referencing this discussion on how to deny loopback access, create the opposite which is to only allow access from localhost. The goal is to only allow access after the client has connected with SSH using the port tunneling option.

Add new filter rules to block VNC (port 5900) access when not connected via SSH with port forwarding. Plus add blocks to file sharing (SMB and AFP). Just in case I am running a web server block that too, or any other ports listed in this link.

# pfctl is the packet filter firewall for modern OS X. 
# For more info -> man pfctl
# flush to the default