Skip to content

Instantly share code, notes, and snippets.

View bjorg's full-sized avatar

Steve Bjorg bjorg

View GitHub Profile
@bjorg
bjorg / pull-all.sh
Created May 13, 2024 18:01
Script for running 'git pull' in every folder
#!/bin/bash
# Default to the current directory if no directory is provided
REPO_DIR="${1:-.}"
# Check if the directory exists
if [ ! -d "$REPO_DIR" ]; then
echo "Directory does not exist: $REPO_DIR"
exit 1
fi
@bjorg
bjorg / ArgumentAssertException.cs
Last active February 15, 2022 00:08
ArgumentAssertException Utility class to validate arguments
namespace System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
public class ArgumentAssertException : ArgumentException {
//--- Class Methods ---
public static void Assert(
[DoesNotReturnIf(false)] bool expression,
@bjorg
bjorg / template-websocket.yml
Created July 7, 2020 16:34
I think I'm running into a CloudFormation bug with AWS::ApiGatewayV2::Stage RouteSettings. The following template fails with this error message when RouteSettings is included, otherwise it succeeds. Am I doing it wrong?
AWSTemplateFormatVersion: '2010-09-09'
Resources:
ModuleWebSocketStage:
Type: AWS::ApiGatewayV2::Stage
Properties:
ApiId: !Ref ModuleWebSocket
StageName: LATEST
DeploymentId: !Ref ModuleWebSocketDeployment7DE845992A5611C1BEBFBCD7A01DB8B8
@bjorg
bjorg / websockets-cloudformation.json
Created June 18, 2020 18:26
CloudFormation JSON for API Gateway WebSocket
{
"AWSTemplateFormatVersion": "2010-09-09",
"Parameters": {
"Secrets": {
"Type": "String",
"Description": "Secret Keys (ARNs)",
"Default": ""
},
"XRayTracing": {
"Type": "String",
@bjorg
bjorg / omnisharp.json
Created July 19, 2019 18:05
OmniSharp Settings for K&R formatting
{
"FormattingOptions": {
"NewLinesForBracesInTypes": false,
"NewLinesForBracesInAccessors": false,
"NewLinesForBracesInAnonymousMethods": false,
"NewLinesForBracesInAnonymousTypes": false,
"NewLinesForBracesInLambdaExpressionBody": false,
"NewLinesForBracesInObjectCollectionArrayInitializers": false,
"NewLinesForBracesInProperties": false,
"NewLinesForBracesInControlBlocks": false,
Array.prototype.forEach.call(document.getElementsByClassName('load-diff-button'), (el) => el.click())
@bjorg
bjorg / download-cloudwatchlogs
Last active January 9, 2024 01:19
Download all CloudWatch logs
log_group_name="/aws/log-group-name"
log_stream_names=$(aws logs describe-log-streams \
--log-group-name "$log_group_name" \
--order-by LastEventTime \
--descending \
--max-items 50 \
--output text \
--query 'logStreams[*].logStreamName')
@bjorg
bjorg / gist:ee69162487285ec4b089f629ec96b5fd
Created May 9, 2017 17:03
Install Amazon.Lambda.Templates
dotnet new -i Amazon.Lambda.Templates::*
@bjorg
bjorg / gist:be3f29855e985e1aeadc
Last active August 29, 2015 14:22
MacBook Settings
# Delay deep sleep for 24hrs, which drains batteries more,
# but prevents system restarts when the computer is sleeping
# for more than 4 hours (the default value).
# NOTE: if the computer sleeps for 24+ hours, it will still cause a system restart.
sudo pmset -a standbydelay 86400
# Improve performance of VMware Fusion
# from http://kb.parallels.com/122767
sudo nvram boot-args="debug=0x10"
@bjorg
bjorg / git-delete-orig.sh
Created December 16, 2014 22:22
Remove .orig files from a git repo.
#!/bin/sh
find . -name '*.orig' -type f | xargs /bin/rm -f