Skip to content

Instantly share code, notes, and snippets.

View mikebridge's full-sized avatar
🤔
Thinking

Mike Bridge mikebridge

🤔
Thinking
View GitHub Profile
@mikebridge
mikebridge / openapi.yaml
Created October 28, 2023 23:22
Test OpenAPI
openapi: 3.0.0
paths:
/:
get:
operationId: AppController_getHello
parameters: []
responses:
'200':
description: ''
/tracks/{id}:
@mikebridge
mikebridge / .zshrc
Created September 18, 2023 15:54
zshrc
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# NVM INTEGRATION
# https://github.com/nvm-sh/nvm#deeper-shell-integration
autoload -U add-zsh-hook
@mikebridge
mikebridge / NGrokHostname.psm1
Last active January 27, 2021 02:37
Get the running ngrok host name via PowerShell
function Get-NGrokHostName
{
Param(
[Parameter(Mandatory = $True)][String]$TunnelName
)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$response = Invoke-WebRequest 'http://127.0.0.1:4040/api/tunnels'
$obj = $response.Content | ConvertFrom-Json
@mikebridge
mikebridge / test_sql.py
Last active April 15, 2020 23:53
django-simple-history test
from decimal import Decimal
from functools import reduce
from django.db import connection, reset_queries
from apps.accounts.models import User
me = User.objects.get(email='test@example.org')
iterations = 1000
def test_save(iterations1 = 1000):
reset_queries()
for i in range(iterations1):
@mikebridge
mikebridge / deploy-operations.yml
Created March 15, 2019 19:10
Example Kubernetes config to deploy TeamCity server + three agents with mssql on azure
# Kubernetes deployment for teamcity server with three agents, each with mssql/development on azure.
# This assumes a two-node cluster
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: teamcity-server-premium-logs-disk
spec:
accessModes:
# https://docs.microsoft.com/en-us/azure/aks/azure-disks-dynamic-pv
@mikebridge
mikebridge / cleanCache.ps1
Created February 7, 2019 19:27
Clear react-native android caches on windows with powershell
# This assumes that it's in a folder `scripts` beside the `build` folder.
#
# Try to address this error:
#
# Unable to resolve module `@blah/whatever` from `whatever.js`: Module `@blah/whatever` does not exist in the Haste module map
#
# This might be related to https://github.com/facebook/react-native/issues/4968
# To resolve try the following:
# 1. Clear watchman watches: `watchman watch-del-all`.
# 2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
#!/usr/bin/env bash
#?
# SSL Info - Displays information about the provided URL's SSL certificate.
#
# USAGE
# sslinfo [OPTIONS] URL
#
# ARGUMENTS
# 1. URL (string): URL to display SSL certificate information for. Should
# not have a scheme components (ex., https://).
@mikebridge
mikebridge / config.sh
Last active December 6, 2018 21:10
Configure dotnet/yarn/docker on an Ubuntu 18.04 machine
#!/bin/bash
$USERNAME="Staging"
$USERLOGIN="staging"
sudo apt-get install emacs-nox
# Add DotNet tools:
# https://dotnet.microsoft.com/download/linux-package-manager/ubuntu18-04/sdk-current
@mikebridge
mikebridge / GravatarHasher.cs
Last active March 9, 2018 17:02
Gravatar Hasher
using System;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace Common
{
public static class GravatarHasher
{
/// <summary>
@mikebridge
mikebridge / DemoTests.cs
Created February 20, 2018 20:28
Mock EF DbContext with SQLite for XUnit Test
using Microsoft.Data.Sqlite;
using Microsoft.EntityFrameworkCore;
// ...
public static MyDbContext InMemoryContext()
{
// SEE: https://docs.microsoft.com/en-us/ef/core/miscellaneous/testing/sqlite
var connection = new SqliteConnection("Data Source=:memory:");
var options = new DbContextOptionsBuilder<MyDbContext>()
.UseSqlite(connection)