Skip to content

Instantly share code, notes, and snippets.

Brad Jones brad-jones

View GitHub Profile
@brad-jones
brad-jones / Dockerfile
Created May 11, 2020
apt virtual deps, like apk virtual
View Dockerfile
RUN export BUILD_PACKAGES="gnupg curl ca-certificates apt-transport-https" \
&& export EXISTING_PACKAGES="$(mktemp)" && apt-mark showauto | sort > $EXISTING_PACKAGES \
&& apt-get update && apt-get install -y --no-install-recommends $BUILD_PACKAGES \
&& export NEW_PACKAGES="$(mktemp)" && apt-mark showauto | sort > $NEW_PACKAGES \
&& export PACKAGES_TO_REMOVE="$(comm -23 $NEW_PACKAGES $EXISTING_PACKAGES)" \
\
&& mkdir -p /usr/share/man/man1 \
&& curl -s https://apt.corretto.aws/corretto.key | apt-key add - \
&& echo 'deb https://apt.corretto.aws stable main' > /etc/apt/sources.list.d/corretto.list \
&& apt-get update && apt-get install -y --no-install-recommends java-1.8.0-amazon-corretto-jdk \
View login.ps1
cmdkey /generic:"TERMSRV/{{IP_OR_HOSTNAME}}" /user:"{{USERNAME}}" /pass:"{{PASSWORD}}"; mstsc.exe /v:"{{IP_OR_HOSTNAME}}"; cmdkey /delete:"TERMSRV/{{IP_OR_HOSTNAME}}";
View keybase.md

Keybase proof

I hereby claim:

  • I am brad-jones on github.
  • I am bradjones (https://keybase.io/bradjones) on keybase.
  • I have a public key ASCTchBbxm2cbiSY41DxpQVSFARWzcWGFRZ2FGfuj4_TzQo

To claim this, I am signing this object:

View Dockerfile
FROM alpine:latest AS devel
RUN apk --no-cache add git
RUN mkdir /app
RUN touch /app/foo
FROM scratch AS runtime
COPY --from=devel /app/. /app
@brad-jones
brad-jones / systemd-boot-kernel-updater
Created Jun 13, 2018
Useful for when you want to dual boot with MacOs or not use Grub.
View systemd-boot-kernel-updater
#!/usr/bin/env bash
set -eo pipefail;
echo "Fedora Systemd-Boot Kernel Update Script";
echo "================================================================================";
latestVmlinuz="$(ls -t /boot/vmlinuz* | head -1)";
latestVersion="$(echo $latestVmlinuz | sed -e 's~/boot/vmlinuz-~~' -e 's~.x86_64~~')";
echo "Installing latest kernel ($latestVersion) into systemd-boot";
@brad-jones
brad-jones / post.md
Created Jun 4, 2018
Get GOing with golang
View post.md

Get GOing with golang

After initially starting with golang, I found it very refreshing, it's super fast, has a great supportive toolset, fantatsic IDE integrations, super duper easy cross compilation and so on.

After some time though, especially after building some more complex apps and libraries, I started to feel like I was in a giant mess of go code, sure it worked but many of the princiapls that have been so foundational in other languages, like loose coupling, dependency injection, inversion of control, even simple things like package structure and namespacing seem to have

@brad-jones
brad-jones / index.js
Created Nov 7, 2017
Get a list of required polyfill.io features based on browserslist
View index.js
const semver = require('semver');
const browserslist = require('browserslist');
const polyFillService = require('polyfill-service');
function browserVersionMatches(browsersListVersion, polyFillServiceVersion)
{
// Do some quick and easy checks first
if (browsersListVersion === polyFillServiceVersion) return true;
if (polyFillServiceVersion === '*') return true;
if (browsersListVersion === 'all') return true;
@brad-jones
brad-jones / transpile.ts
Created Oct 11, 2017
ts-simple-ast script to add real reflection to typescript/javascript
View transpile.ts
import * as ts from 'typescript';
import TsSimpleAst, { TypeGuards, GetAccessorDeclaration, SetAccessorDeclaration, PropertyDeclaration, Type, TypeNode, Node, TypedNode, Scope } from "ts-simple-ast";
let ast = new TsSimpleAst
({
tsConfigFilePath: __dirname + '/tsconfig.options.json',
compilerOptions: { outDir: __dirname + '/dist' }
});
ast.addSourceFiles(__dirname + '/src/**/*{.d.ts,.ts}');
@brad-jones
brad-jones / test.cs
Created Sep 5, 2017
Intial setup for RazorLight dotnet 2.0
View test.cs
using System;
using Xunit;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Language.Extensions;
using Microsoft.Extensions.PlatformAbstractions;
using Microsoft.AspNetCore.Mvc.Razor.Extensions;
namespace Tests.Razor
{
public class RazorTests
@brad-jones
brad-jones / Dockerfile
Created Apr 10, 2017
docker-dotnet-vscode
View Dockerfile
FROM microsoft/dotnet:latest
# Install Node.js repo
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash -
# Install the VsCode repo
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg && \
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg && \
echo "deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list
You can’t perform that action at this time.