Skip to content

Instantly share code, notes, and snippets.

View michaeltrainor's full-sized avatar
:octocat:
Riding in a giant-spinning-molten-crust-ball spaceship.

haktwld michaeltrainor

:octocat:
Riding in a giant-spinning-molten-crust-ball spaceship.
View GitHub Profile
@michaeltrainor
michaeltrainor / cheatsheet.ps1
Created December 26, 2023 05:58 — forked from pcgeek86/cheatsheet.ps1
PowerShell Cheat Sheet / Quick Reference
Get-Command # Retrieves a list of all the commands available to PowerShell
# (native binaries in $env:PATH + cmdlets / functions from PowerShell modules)
Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft*
Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item"
Get-Help # Get all help topics
Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page)
Get-Help -Name Get-Command # Get help for a specific PowerShell function
Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command
@michaeltrainor
michaeltrainor / bezdraw.py
Created June 20, 2022 10:17 — forked from Alquimista/bezdraw.py
Draw Bezier curves using Python and PySide6
#!/usr/bin/env python3
import sys
import math
from PySide6 import QtGui, QtCore, QtWidgets
def binomial(i, n):
"""Binomial coefficient"""
@michaeltrainor
michaeltrainor / treeview_test.py
Created May 19, 2022 20:54 — forked from nbassler/treeview_test.py
PyQt5 TreeView with QAbstractItemModel
"""
Reworked code based on
http://trevorius.com/scrapbook/uncategorized/pyqt-custom-abstractitemmodel/
Adapted to Qt5 and fixed column/row bug.
TODO: handle changing data.
"""
import sys
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@michaeltrainor
michaeltrainor / setting.json
Created November 6, 2020 09:51
VSCode Houdini Python Settings
{
"python.autoComplete.extraPaths": [
"C:/PROGRA~1/SIDEEF~1/HOUDIN~1.351/houdini/python2.7libs"
],
"python.languageServer": "Pylance",
"terminal.integrated.env.windows": {
"PYTHONPATH" : "C:/PROGRA~1/SIDEEF~1/HOUDIN~1.351/python27/houdini/python2.7libs",
"PATH" : "${env:PATH};C:/PROGRA~1/SIDEEF~1/HOUDIN~1.351/python27/bin"
},
"python.analysis.extraPaths": [
@michaeltrainor
michaeltrainor / get-bearer-token-twitter-api
Created August 13, 2020 19:47 — forked from valeriocos/get-bearer-token-twitter-api
Get a bearer token for Twitter application-only requests in Python3
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2015-2018 Bitergia
#
# 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.
#
@michaeltrainor
michaeltrainor / async_get_files.py
Last active August 1, 2020 14:10
asynchronous file path generator
# standard libraries
import os
import asyncio
from pathlib import Path
async def get_files(search_path, type_filter=None):
""" asynchronous file path generator
"""
p = Path(search_path)
@michaeltrainor
michaeltrainor / profile.ps1
Created July 22, 2020 09:52 — forked from timsneath/profile.ps1
PowerShell template profile: adds some useful aliases and functions
### PowerShell template profile
### Version 1.03 - Tim Sneath <tim@sneath.org>
### From https://gist.github.com/timsneath/19867b12eee7fd5af2ba
###
### This file should be stored in $PROFILE.CurrentUserAllHosts
### If $PROFILE.CurrentUserAllHosts doesn't exist, you can make one with the following:
### PS> New-Item $PROFILE.CurrentUserAllHosts -ItemType File -Force
### This will create the file and the containing subdirectory if it doesn't already
###
### As a reminder, to enable unsigned script execution of local scripts on client Windows,
@michaeltrainor
michaeltrainor / .bash_profile
Created February 6, 2019 13:28 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@michaeltrainor
michaeltrainor / read_file_binary.hpp
Created February 14, 2018 12:00
Read a Binary File to std::vector<BYTE>
#include <fstream>
#include <iterator>
inline std::vector<uint8_t> read_file_binary(const std::string& file_path)
{
std::ifstream file_buffer(file_path, std::ios::binary);
file_buffer.unsetf(std::ios::skipws);
file_buffer.seekg(0, std::ios::end);
const auto size = file_buffer.tellg();