Skip to content

Instantly share code, notes, and snippets.

View Jamie-'s full-sized avatar

Jamie Scott Jamie-

View GitHub Profile
@Jamie-
Jamie- / logging.js
Created June 19, 2020 23:19
Simple custom JS logging formating
const timestamp = () => `${new Date().toISOString()}`;
const log = {
debug: (...args) => console.debug(timestamp(), "[DEBUG]", ...args),
info: (...args) => console.info(timestamp(), "[INFO]", ...args),
warning: (...args) => console.warn(timestamp(), "[WARNING]", ...args),
error: (...args) => console.error(timestamp(), "[ERROR]", ...args),
};
// Usage
log.debug("a debug message");
@Jamie-
Jamie- / esxi_info.py
Last active January 7, 2019 14:34
Pull version info from an ESXi machine without needing to login.
import re
import argparse
import requests
import urllib3
def get_version_info(ip):
req = '<soap:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Header><operationID>00000001-00000001</operationID></soap:Header><soap:Body><RetrieveServiceContent xmlns="urn:internalvim25"><_this xsi:type="ManagedObjectReference" type="ServiceInstance">ServiceInstance</_this></RetrieveServiceContent></soap:Body></soap:Envelope>'
resp = requests.post('https://{}/sdk'.format(ip), data=req, verify=False)
if resp.status_code != 200:
raise Exception('Did not get 200 OK back from target, instead got {}'.format(resp.status_code))
@Jamie-
Jamie- / ffmpeg.md
Created September 8, 2018 23:19
ffmpeg Cheat Sheet

Create 1080p timelapse from JPEGs in current directory.

ffmpeg -r 15 -pattern_type glob -i '*.JPG' -s hd1080 -vcodec libx264 output.mp4

Extract raw audio stream from video file.

ffmpeg -i input.mp4 -vn -acodec copy output.aac
@Jamie-
Jamie- / map.txt
Created January 23, 2018 16:33
HDanywhere 4x8 Serial/Telnet Commands
a09, a1D, a1F, a0D
a19, a1B, a11, a15
a17, a12, a59, a08
a50, a55, a48, a4A
a5E, a06, a05, a03
a47, a07, a40, a02
a18, a44, a0F, a51
a0A, a1E, a0E, a1A
@Jamie-
Jamie- / .bash_aliases
Last active June 12, 2021 09:12
macOS Brew bashrc
# Shortcuts
alias ..='cd ..'
alias l='ls'
alias ll='ls -al'
alias la='ls -A'
@Jamie-
Jamie- / boilerplate.py
Last active April 24, 2021 16:44
Python 3 boilerplate with hashbang, argparse and logging.
#!/usr/bin/env python3
import argparse
import logging
logging.basicConfig(
format="[%(asctime)s.%(msecs)03d][%(levelname)8s][%(module)s] %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
# level=logging.INFO,
)