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 / 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 / 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
#!/bin/bash -
#===============================================================================
#
# FILE: csb_updated.sh
#
# USAGE: ./csb_updated.sh
#
# DESCRIPTION: Updated version of Client SQL Backup (csb) script.
#
# OPTIONS: ---
#!/usr/bin/python
#
# Copyright (c) Citrix Systems 2007-2011
# Author: Gianni Tedesco and Dave Scott
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; version 2.1 only. with the special
# exception on linking described in file LICENSE.
#
@pkutzner
pkutzner / gist:744ca34c4aab4b9c6d5872fa0bf9135a
Created April 25, 2018 20:27
Create ISO from AppStore download of macOS installer
Open Terminal, then run the following commands one at a time:
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
cp -rp /Volumes/install_app/BaseSystem.dmg /Volumes/OS\ X\ Base\ System/BaseSystem.dmg
hdiutil detach /Volumes/install_app