Skip to content

Instantly share code, notes, and snippets.

@pkutzner
pkutzner / multicloudsync.plist
Created August 26, 2015 22:23
Sync to multiple clouds
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0/EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>mulitcloudsync</string>
<key>ProgramArguments</key>
<array>
<string>/opt/local/bin/rsync</string>
<string>-aq</string>
@pkutzner
pkutzner / gen_pkp_csrs.sh
Last active December 11, 2015 23:53
Script to generate 2 CSR/Key pairs (and pins) for use with HPKP. Asks for pertinent information interactively.
#!/bin/bash -
#===============================================================================
#
# FILE: gen_pkp_csrs.sh
#
# USAGE: ./gen_pkp_csrs.sh
#
# DESCRIPTION: Generates SSL CSR/Key pairs.
# This script generates both the primary CSR/Key pair for a given
# URL and SAN(s) (if specified), as well as a backup pair for use
#!/bin/bash
# XKCD/diceware-style password generator that ensures at least one
# upper-case character is present and that each word has a
# minimum of 6 characters. Suitable for adding to your .aliases
# file.
dicepass() {
while true; do
local xpass=$(look . | grep -oE "^[A-Za-z]{6,}$" | shuf | head -4 | xargs)
if echo "$xpass" | grep -E "[A-Z]" >/dev/null 2>&1; then
@pkutzner
pkutzner / showping.sh
Created July 13, 2016 15:02
Who's pinging me?
#!/bin/bash
if [ $UID != 0 ]; then
sudo -v
fi
sudo tcpdump -l 'icmp[icmptype]=icmp-echo' | awk '{if (!arr[$3]){print $3;arr[$3]++}}'
@pkutzner
pkutzner / multkwrdsearch.txt
Created October 1, 2016 05:17
Google Chrome Multi Keyword Search
javascript:
var s='%s';
url='YOUR URL, WITH %s's FOR EACH TERM';
query='';
urlchunks=url.split('%s');
schunks=s.split(';');
for(i=0; i<schunks.length; i++)query+=urlchunks[i]+schunks[i];
location.replace(query);
wireshark -k -i <(tail -c +0 -F /path/to/pcap)
@pkutzner
pkutzner / gist:eea2533f43f02138c7d114f16f66d315
Created May 22, 2017 02:32
Command to trace nic in Virtualbox
vboxmanage modifyvm "[VM NAME]" --nictrace# on --nictracefile# /path/to/file.pcap
Where '#' is the interface number you want to capture.
@pkutzner
pkutzner / chromeosvpn.md
Last active November 13, 2022 05:55
Create ChromeOS VPN connection.

Creating an OpenVPN Configuration for ChromeOS

This assumes you already have an OpenVPN server set up that you'll be connecting to. OpenVPN server setup is not covered in this document.

NOTE: ChromeOS is VERY picky about adherance to the ONC filespec (second ref. link). If an option is marked as an integer, and you surround it in quotes, import of the file will fail silently. Booleans (true and false) seem to be an exception wherein you can either wrap, or not, the boolean value in quotes without it failing ¯\_(ツ)_/¯.

References:

ChromeOS supports both L2TP and OpenVPN VPN connections. However, adding an OpenVPN connection, other than a really basic one, is non-trivial, as many options are missing from the GUI; things such as setting the Cipher or the Auth types, setting CompLZO, or any myriad nonstandard

#!/bin/bash
set -u
THELIST=( 'one' 'two' 'three' 'four' 'five' 'six' 'seven' 'eight' 'nine' 'ten' )
THEITEM='twelve'
declare -a EXTLIST=()
EXTLIST=( 'eleven' 'twelve' )
if [[ ${#EXTLIST[@]} -gt 0 ]]; then
THELIST+=( "${EXTLIST[@]}" )
@pkutzner
pkutzner / ubuntu_samba_backup.sh
Created February 6, 2018 22:30
Samba4 Backup Script for Ubuntu package installations.
#!/bin/bash
#
# Copyright (C) Matthieu Patou <mat@matws.net> 2010-2011
# Copyright (C) Preston Kutzner <pkutzner@gmail.com> 2018
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#