Skip to content

Instantly share code, notes, and snippets.

View pythoninthegrass's full-sized avatar

pythoninthegrass

View GitHub Profile
@pythoninthegrass
pythoninthegrass / Proxmox reload services
Created February 15, 2021 21:19 — forked from kevin39/Proxmox reload services
Proxmox reload services properly (services order is important)
service pve-cluster restart && service pvedaemon restart && service pvestatd restart && service pveproxy restart
@pythoninthegrass
pythoninthegrass / lambda_vs_itemgetter.py
Created January 29, 2021 04:25 — forked from nickholt-driver/lambda_vs_itemgetter.py
Benchmark for lambdas versus itemgetter
import random
from operator import itemgetter
import timeit
def random_point():
return (random.randint(0, 100), random.randint(0, 100), random.randint(0, 100))
points = None # Global because of timeit scoping
def test_lambda():
@pythoninthegrass
pythoninthegrass / Change Jamf Pro Activation Code.sh
Created December 2, 2020 22:27 — forked from talkingmoose/Change Jamf Pro Activation Code.sh
Programmatic method to change a Jamf Pro server's Activation Code via the Classic API.
#!/bin/bash
# server connection information
URL="https://jss.talkingmoose.net:8443"
userName="JSSAPI-Editor"
password="password"
# XML data to upload
THExml="<activation_code>
<organization_name>Talking Moose Industries</organization_name>
@pythoninthegrass
pythoninthegrass / jcds_upload.py
Created May 20, 2020 20:41
A quick-and-dirty script for uploading packages to a Jamf Cloud Distribution Server
#!/usr/bin/python
'''
JCDS package upload script
by G Pugh
Developed from an idea posted at
https://www.jamf.com/jamf-nation/discussions/27869#responseChild166021
Usage:
@pythoninthegrass
pythoninthegrass / secure_bash_passwords.sh
Created April 26, 2020 20:42
Store and use secure passwords in bash
#!/bin/bash
# Mixing in python with bash we can easily retrieve our passwords securely in our shell scripts.
# Read this first: https://live.gnome.org/GnomeKeyring/SecurityPhilosophy
# Make sure your distro has gnome-keyring-daemon installed and running at login,
# as well as python-keyring installed (sudo apt-get install python-keyring)
##
# Follow these steps to see what it does. Verify by looking in Seahorse for your password.
##
@pythoninthegrass
pythoninthegrass / create_iso.sh
Last active April 4, 2020 02:12 — forked from julianxhokaxhiu/create-iso.sh
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
#!/usr/bin/env bash
# SOURCE:
# https://gist.github.com/julianxhokaxhiu/6ed6853f3223d0dd5fdffc4799b3a877
# TODO: error handling
# activate verbose standard output (stdout)
set -v
# activate debugging (execution shown)

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@pythoninthegrass
pythoninthegrass / scp-aws.md
Created March 25, 2020 22:52 — forked from stephaniemdavis/scp-aws.md
Syntax for using scp to to download a file from AWS to local disk

The following line uses the secure copy protocol to copy a file from an aws instance to the current (".") folder of a local machine.

scp -i aws.pem username@awsip(or ALIAS):/path/to/file .

aws.pem is the key AWS provides you to gain access to the AWS instance you want to copy from.

awsip is the IP address or DNS alias of the AWS instance.

path/to/file is the file's path on aws.

It is extremely important to add the period after the /path/to/file. Note the blank space between the /path/to/file and the period.

https://stackoverflow.com/questions/9441008/how-can-i-download-a-file-from-ec2

The obverse is true too; to upload FROM local folder to aws:

@pythoninthegrass
pythoninthegrass / scp-aws.md
Created March 25, 2020 22:52 — forked from stephaniemdavis/scp-aws.md
Syntax for using scp to to download a file from AWS to local disk

The following line uses the secure copy protocol to copy a file from an aws instance to the current (".") folder of a local machine.

scp -i aws.pem username@awsip(or ALIAS):/path/to/file .

aws.pem is the key AWS provides you to gain access to the AWS instance you want to copy from.

awsip is the IP address or DNS alias of the AWS instance.

path/to/file is the file's path on aws.

It is extremely important to add the period after the /path/to/file. Note the blank space between the /path/to/file and the period.

https://stackoverflow.com/questions/9441008/how-can-i-download-a-file-from-ec2

The obverse is true too; to upload FROM local folder to aws:

@pythoninthegrass
pythoninthegrass / reinit-sound.sh
Created March 25, 2020 21:37 — forked from akorobov/reinit-sound.sh
Fix(audio subsystem reinitialization) for no sound in osx 10.9(.2?) after sleep with headphones in
sudo kextunload /System/Library/Extensions/AppleHDA.kext
sudo kextload /System/Library/Extensions/AppleHDA.kext
sudo killall -9 coreaudiod