Skip to content

Instantly share code, notes, and snippets.

View trstringer's full-sized avatar

Thomas Stringer trstringer

View GitHub Profile
@trstringer
trstringer / FindAllGitRepos.ps1
Created June 26, 2015 15:39
Searches all file system drives for all Git repositories, and then lists them out
foreach ($DriveRoot in (Get-PSDrive | Where-Object {$_.Provider -like "*FileSystem"} | Select-Object -ExpandProperty Root)) {
Set-Location $DriveRoot
$FoundRepos =
Get-ChildItem ".git" -Directory -Force -Recurse -ErrorAction SilentlyContinue |
Select-Object @{Name = "Repository"; Expression = { $_.FullName.Substring(0, $_.FullName.IndexOf("\.git")) }}
if ($FoundRepos -eq $null) {
$RepoCount = 0
}
@trstringer
trstringer / LoopingNetworkSpeedTest.ps1
Last active June 1, 2022 20:07
The steps to routinely (looping) check local to internet performance
Write-Warning "This code is not meant to be run sequentially, run it in sections following comment instructions"
exit
<##############################################################################
create transfer file
##############################################################################>
$FilePath = "C:\temp\transfer_file.txt"
$DesiredFileSizeKB = 1024 * 7 # 7 MB
\ /
\ / HAPPY /---\ /---\ /-| /---\
** NEW ___/ | | | |
___* *___ YEAR / | | | |---\
* * \___/ \---/ | \---/
** ***
/| \ * * \|/
/ | \ * * * * -*-
| * * * /|\
| \|/ * * * * |
@trstringer
trstringer / VSCodeVsSublimeStartup.ps1
Created February 17, 2016 14:36
Compare the startup time of VS Code and Sublime
$codeProcessName = "code"
$sublimePath = "C:\Program Files\Sublime Text 2\sublime_text.exe"
$sublimeProcessName = "sublime_text"
function StartAndTimeProcess {
param (
[string]$processName,
[string]$processPath
)
$before = Get-Date
@trstringer
trstringer / GetPackageUrlAssociations.ps1
Created March 18, 2016 15:58
Retrieve all URI associations for apps from the registry
if (!(Test-Path "hkcr:\")) {
New-PSDrive -PSProvider registry -Root HKEY_CLASSES_ROOT -Name HKCR -ErrorAction Stop | Out-Null
}
$rootKey = "HKCR:\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages"
$associationsParent = "App\Capabilities\URLAssociations"
$output =
foreach ($child in (Get-ChildItem -Path $rootKey)) {
try {
#!/bin/bash
create_venv() {
python3 -m venv venv >& /dev/null
. venv/bin/activate
}
remove_venv() {
if [ -d "./venv" ]; then
rm -rf ./venv
#!/usr/bin/env python3
"""Generate the parent index for the wiki repo"""
import os
import re
def direct_dirs():
"""Retrieve immediate directories list"""
@trstringer
trstringer / install.sh
Created October 30, 2017 21:17
Miki terminal workflow
#!/bin/bash
CWD=$(python -c "import os; print(os.getcwd())")
python3 -m venv venv
. venv/bin/activate
pip install -r requirements.txt
cat > ~/bin/miki << EOF
cd $CWD
from flask import Flask, jsonify, request
import redis
app = Flask(__name__)
@app.route('/')
def default_route():
"""Default route to return a simple message"""
return jsonify('hello world')
FROM python:alpine3.6
WORKDIR /usr/src/app
EXPOSE 8000
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["gunicorn", "--workers=2", "--bind=0.0.0.0:8000", "app:app"]