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 / resque_check.sh
Last active December 4, 2015 03:01
Resque status CLI script
# Turns the number of seconds elapsed into an appropriate stringified description
function seconds_to_human_readable()
{
local SECONDS=$1
if [ ${SECONDS} -lt 1 ]; then
RESULT="just now"
elif [ ${SECONDS} -lt 60 ]; then
RESULT="${SECONDS} seconds"
elif [ ${SECONDS} -lt 3600 ]; then
@J-Swift
J-Swift / git-stash-staged
Created July 18, 2018 01:42
Custom git command to stash only the staged changes
#!/usr/bin/env bash
# https://stackoverflow.com/a/39644782/1273175
((!$#)) && echo 'Must provide a stash name!' && exit 1
if ! $( git status --porcelain | grep -v '??' | grep -E '^[^ ]' --silent ); then
echo 'No staged changes detected!'
exit 1
fi
@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
@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 / 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' ">
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 / __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 / 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 / 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 / index.js
Last active March 14, 2020 18:55
Puppeteer - get recent BBT transactions
const chromium = require('chrome-aws-lambda');
const chalk = require('chalk');
const USERNAME = process.env.USERNAME;
const PASSWORD = process.env.PASSWORD;
const DEFAULT_TIMEOUT = 5000;
const hl_info = chalk.bold.white;
const info = chalk.gray;
const positive = chalk.green;