Skip to content

Instantly share code, notes, and snippets.

@pkutzner
pkutzner / ConfigureRemotingForAnsible.ps1
Created February 25, 2024 21:05
Script to configure PSRemoting for Ansible
#Requires -Version 3.0
# Configure a Windows host for remote management with Ansible
# -----------------------------------------------------------
#
# This script checks the current WinRM (PS Remoting) configuration and makes
# the necessary changes to allow Ansible to connect, authenticate and
# execute PowerShell commands.
#
# All events are logged to the Windows EventLog, useful for unattended runs.
ComputerName
OnlineStatus
WSManStatus (i.e. Powershell Remoting)
IPAddress
FQDN
PTR
SysInfo:
RAM
Manufacturer
Model
@pkutzner
pkutzner / color.pkla
Created August 21, 2023 22:19
Add to /etc/polkit-1/localauthority/50-local.d to remove the color device error when using xrdp
[Allow colord for all users]
Identity=unix-user:*
Action=org.freedesktop.color-manager.create-device;org.freedesktop.color-manager.create-profile;org.freedesktop.color-manager.delete-device;org.freedesktop.color-manager.delete-profile;org.freedesktop.color-manager.modify-device;org.freedesktop.color-manager.modify-profile;org.freedesktop.packagekit.system-sources-refresh
ResultAny=yes
ResultInactive=yes
ResultActive=yes
@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

@pkutzner
pkutzner / privacy.sh
Created February 13, 2014 20:14
Script to clear out Safari caches
#!/bin/bash
set -o nounset
pgrep Safari >/dev/null 2>&1 && { echo "Safari is still running, exiting..." | logger -t "privacy.sh"; exit 1; } || { echo "Removing Safari history/caches..." | logger -t "privacy.sh"; }
library="/Users/USER/Library"
safari_root="${library}/Safari"
sleep 5
@pkutzner
pkutzner / README.md
Created November 20, 2021 15:30 — forked from zoilomora/README.md
How to disable cloud-init in Ubuntu

How to disable cloud-init in Ubuntu

Prevent start

  • Create an empty file to prevent the service from starting

      sudo touch /etc/cloud/cloud-init.disabled
    

Uninstall

#!/bin/sh -e
#
# 98-vpn - Automatically bring up VPN on listed WiFi UUIDs
#
# Copyright (c) 2019 Preston Kutzner <pkutzner at gmail dot com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License (GPL) as published
# by the Free Software Foundation (FSF), either version 3 of the License,
# or (at your option) any later version.
@pkutzner
pkutzner / get_google_ranges.sh
Last active November 24, 2019 16:29
Shell script to get public Google Cloud IP ranges
#!/usr/bin/env bash
#set -x
#trap read debug
URL="_cloud-netblocks.googleusercontent.com"
get_ranges() {
local includes=($(host -t TXT "$1"| egrep -o "include:_cloud-[^ ]*" | cut -d':' -f2))
local ranges=($(host -t TXT "$1" | egrep -o "ip4:((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?/([0-9]?[1-3][0-9]))" | cut -d':' -f2))
@pkutzner
pkutzner / gist:bcd53571b93a380c3b9c
Created October 28, 2014 15:12
OSX Network Shell Aliases
alias airport="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport"
alias bssid="networksetup -getairportnetwork $(networksetup -listallhardwareports | grep -A 2 'Hardware Port: Wi-Fi' | grep 'Device:' | awk '{print $2}')"
alias ssid="bssid"
# Use alias below with (on|off) to turn airport card on or off from CL.
alias wifi="networksetup -setairportpower $(networksetup -listallhardwareports | grep -A 2 'Hardware Port: Wi-Fi' | grep 'Device:' | awk '{print $2}')"
alias wifi-info="networksetup -getinfo Wi-Fi"
alias apinfo="airport -I"
alias known-networks="networksetup -listpreferrednetworks $(networksetup -listallhardwareports | grep -A 2 'Hardware Port: Wi-Fi' | grep 'Device:' | awk '{print $2}')"
alias wifi-disconnect="sudo airport -z"
alias wifi-networks="airport -s"
@pkutzner
pkutzner / shodan_ips.txt
Created March 11, 2019 20:32
shodan_ips
198.20.69.74
198.20.69.98
198.20.70.114
198.20.99.130
93.120.27.62
66.240.236.119
71.6.135.131
66.240.192.138
71.6.167.142
82.221.105.6