Skip to content

Instantly share code, notes, and snippets.

View J-Swift's full-sized avatar

Jimmy Reichley J-Swift

  • Rockledge, FL
View GitHub Profile
@J-Swift
J-Swift / ssh_to.sh
Last active April 10, 2022 21:01
Convenience script to intelligently connect to a kubernetes pod/node given the API name
#!/usr/bin/env bash
set -eu
readonly mode="${1:-}"
readonly target="${2:-}"
readonly ssh_key_path="path_to_kops_ssh_key"
die() {
@J-Swift
J-Swift / TokenAuthInterceptor.ts
Created September 26, 2019 19:57
ngUpgrade compatible Angular2 shim for ng-token-auth
import { Injectable, Inject } from '@angular/core';
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http';
import { Observable } from 'rxjs';
import { INgTokenAuthService } from './ng-token-auth';
@Injectable()
export class TokenAuthInterceptor implements HttpInterceptor {
constructor(
@J-Swift
J-Swift / __etc__nginx__nginx.conf
Last active September 6, 2019 19:28
Basic nginx conf for multiple static sites on single host
# nginx Configuration File
# http://wiki.nginx.org/Configuration
# Run as a less privileged user for security reasons.
user www-data www-users;
# How many worker threads to run;
# "auto" sets it to the number of CPU cores available in the system, and
# offers the best performance. Don't set it higher than the number of CPU
# cores if changing this parameter.
@J-Swift
J-Swift / thegamesdb.yaml
Last active January 9, 2020 03:14
Cleaned up swagger spec for thegamesdb
swagger: '2.0'
info:
description: API Documentation
version: 2.0.0
title: TheGamesDB API
license:
name: GNU General Public License v3.0
url: https://github.com/TheGamesDB/TheGamesDBv2/blob/master/LICENSE
# tags are used for organizing operations
@J-Swift
J-Swift / .bash_aliases
Last active June 30, 2024 22:05
Helper to batch convert redump psx bin/cue to chd
function _do_next_chd_print_header() {
local -r text="${1}"
echo
echo '################################################################################'
echo "# ${text}"
echo '################################################################################'
echo
}
evaluating file '/nix/store/1jz25hcma179wbpi56blgajw47n5kgqd-nix-2.2.1/share/nix/corepkgs/derivation.nix'
evaluating file '/nix/store/7jxnk6i5iqln519cpn4g9zf18fp8yn4y-nixpkgs-19.03pre169106.1a88aa9e0cd/nixpkgs/default.nix'
evaluating file '/nix/store/7jxnk6i5iqln519cpn4g9zf18fp8yn4y-nixpkgs-19.03pre169106.1a88aa9e0cd/nixpkgs/lib/minver.nix'
evaluating file '/nix/store/7jxnk6i5iqln519cpn4g9zf18fp8yn4y-nixpkgs-19.03pre169106.1a88aa9e0cd/nixpkgs/pkgs/top-level/impure.nix'
evaluating file '/nix/store/7jxnk6i5iqln519cpn4g9zf18fp8yn4y-nixpkgs-19.03pre169106.1a88aa9e0cd/nixpkgs/pkgs/top-level/default.nix'
evaluating file '/nix/store/7jxnk6i5iqln519cpn4g9zf18fp8yn4y-nixpkgs-19.03pre169106.1a88aa9e0cd/nixpkgs/pkgs/stdenv/booter.nix'
evaluating file '/nix/store/7jxnk6i5iqln519cpn4g9zf18fp8yn4y-nixpkgs-19.03pre169106.1a88aa9e0cd/nixpkgs/lib/default.nix'
evaluating file '/nix/store/7jxnk6i5iqln519cpn4g9zf18fp8yn4y-nixpkgs-19.03pre169106.1a88aa9e0cd/nixpkgs/lib/fixed-points.nix'
evaluating file '/nix/store/7jxnk6i5iqln519
@J-Swift
J-Swift / .bash_aliases
Created February 11, 2019 04:32
bash alias to exit if no jobs suspended
function fge() {
# https://unix.stackexchange.com/a/251050
local -r num_suspended=$(jobs -s | wc -l)
if [ $num_suspended -eq 0 ]; then
exit
else
fg
fi
}
@J-Swift
J-Swift / ProjectName.csproj
Created January 24, 2019 15:50
Multi-targeted .netstandard csproj in VS for Mac
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;Xamarin.iOS10;MonoAndroid81;</TargetFrameworks>
<SynchReleaseVersion>false</SynchReleaseVersion>
<DefineConstants>$(DefineConstants);</DefineConstants>
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
<Configurations>Debug;Release;</Configurations>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
@J-Swift
J-Swift / pods_by_node.sh
Created December 4, 2018 19:02
Show aks pods by node
#!/usr/bin/env bash
set -euo pipefail
readonly temp_dir=$( mktemp -d )
# sudo kubectl get pods
# NAME READY STATUS RESTARTS AGE
# azure-vote-back-655476c7f7-gvg7b 1/1 Running 0 24m
# azure-vote-front-7f98fd48d4-8fkcd 1/1 Running 0 18m
@J-Swift
J-Swift / get_swift_toolchain_id.sh
Created September 6, 2018 18:27
Get swift toolchain id from toolchain download name
#!/usr/bin/env bash
readonly target_swift_toolchain_name='swift-4.1.3-RELEASE.xctoolchain'
readonly toolchain_plist_file_path="/Library/Developer/Toolchains/${target_swift_toolchain_name}/Info.plist"
if [ ! -f "${toolchain_plist_file_path}" ]; then
echo
echo "ERROR: no toolchain found at [${toolchain_plist_file_path}]"
exit 1
fi