Skip to content

Instantly share code, notes, and snippets.

View virtualstaticvoid's full-sized avatar

Chris Stefano virtualstaticvoid

View GitHub Profile
@virtualstaticvoid
virtualstaticvoid / Ensure.cs
Last active November 14, 2018 20:19
C# Ensure for Argument Errors
//
// MIT License
// Copyright (c) 2009 Chris Stefano <virtualstaticvoid@gmail.com>
//
using System;
using System.Diagnostics;
internal static class Ensure
{
[DebuggerStepThrough]
@virtualstaticvoid
virtualstaticvoid / install-ca-certificate
Created July 2, 2020 10:35
Install Custom CA Certificate (with name check)
#!/bin/bash
cert=${1:-ca.pem}
name=$2
sudo mkdir -p /usr/local/share/ca-certificates
sudo cp $cert /usr/local/share/ca-certificates/
sudo update-ca-certificates
@virtualstaticvoid
virtualstaticvoid / shell
Created July 8, 2020 16:22
Get Docker Container IP Address
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' container
@virtualstaticvoid
virtualstaticvoid / .gitignore
Last active January 2, 2021 18:17
Raspberry Pi 4 Ubuntu 20.04.1 LTS configuration and provisioning script
*.xz
*.zip
mnt/*
@virtualstaticvoid
virtualstaticvoid / git-reset-branch
Created February 9, 2021 13:37
Resets a git branch, or switches over from master to main.
#!/bin/bash
set -e
#
# NOTE: can be used to switch over to another branch such from "master" to "main"
#
# git reset-branch main origin/main
#
if [ ! -d .git ]; then
@virtualstaticvoid
virtualstaticvoid / git-use-main
Created April 14, 2021 19:21
master to main branch
#!/bin/bash
git remote set-head origin main
git branch -m master main
@virtualstaticvoid
virtualstaticvoid / .a-heroku-buildpack-r-issue-142
Last active October 2, 2021 13:42
heroku-buildpack-r issue #142
We couldn’t find that file to show.
@virtualstaticvoid
virtualstaticvoid / README.md
Last active February 1, 2022 10:36
Heroku Buildpack R Issue #156
@virtualstaticvoid
virtualstaticvoid / Dockerfile
Last active September 1, 2022 13:17
Using `XGBoost` on Heroku
FROM virtualstaticvoid/heroku-docker-r:build
CMD ["/usr/bin/R", "--no-save", "-f", "/app/app.R"]
@virtualstaticvoid
virtualstaticvoid / git-reset-branch
Last active September 1, 2022 13:26
git-reset-branch
#!/bin/bash
#
# Description:
#
# Resets the local branch which has diverged from it's tracking (remote) branch
# can also be used to switch over from "master" to "main" branch
#
# Usage:
#