Skip to content

Instantly share code, notes, and snippets.

View ichadhr's full-sized avatar
Focusing

Chad ichadhr

Focusing
View GitHub Profile
@ichadhr
ichadhr / create-efi-keys.sh
Created October 22, 2020 11:59 — forked from Era-Dorta/create-efi-keys.sh
Sign kernel modules on Ubuntu, useful for Nvidia drivers in UEFI system
# VERY IMPORTANT! After each kernel update or dkms rebuild the modules must be signed again with the script
# ~/.ssl/sign-all-modules.sh
# Place all files in ~/.ssl folder
mkdir ~/.ssl
cd ~/.ssl
# Generate custom keys with openssl
openssl req -new -x509 -newkey rsa:2048 -keyout MOK.priv -outform DER -out MOK.der -nodes -subj "/CN=Owner/"
@ichadhr
ichadhr / PercentRounder.cs
Created October 23, 2019 07:24 — forked from dochoffiday/PercentRounder.cs
Uses the "Largest Remainder Method" to ensure rounded percentages add up to their correct total
using System;
using System.Collections.Generic;
using System.Linq;
public class PercentRounder
{
public class PercentInfo
{
public int Index;
public int Percent;
#!/usr/bin/env bash
#
# Originally from https://gist.github.com/IanVaughan/2902499
#
# authors: Ian Vaughan
# Jacob Zimmerman
#
# usage: uninstall_gems [<version> ...]
#
# examples:
@ichadhr
ichadhr / url_to_drive.js
Created December 15, 2015 16:44 — forked from denilsonsa/url_to_drive.js
Google Apps Script to upload a file from an URL directly to Google Drive.
// url_to_drive.gs
// Google Apps Script
// Allows uploading a URL directly to Google Drive.
//
// Live link:
// https://script.google.com/macros/s/AKfycbzvhbHS4hnWPVBDHjQzZHA0qWq0GR-6hY7TbYsNto6hZ0MeAFZt/exec
//
// Source-code:
// https://gist.github.com/denilsonsa/8134679
// https://script.google.com/d/1Ye-OEn1bDPcmeKSe4gb0YSK83RPMc4sZJt79SRt-GRY653gm2qVUptoE/edit
@ichadhr
ichadhr / vm-resize-hard-disk.md
Last active February 5, 2017 18:56 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirtualBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

@ichadhr
ichadhr / attach-pull-request.sh
Last active October 7, 2019 15:51 — forked from ihanson/attach-pull-request
Attaching a pull request to an existing GitHub issue
#!/usr/bin/env bash
read -p "GitHub username: " -ei $(git config --get github.user) USERNAME
read -sp "GitHub password: " PASSWORD
echo
read -p "Submit pull request to user: " TO_USER
read -p "Submit pull request to repository: " TO_REPO
read -p "Submit pull request to branch: " -ei master TO_BRANCH
read -p "Submit pull request from user: " -ei $USERNAME FROM_USER
read -p "Submit pull request from branch: " FROM_BRANCH
#!/usr/bin/env bash
if [ ! -f package.json ]; then
echo "This script must be run from the ghost blog directory"
exit 1
fi
ZIP_URL=https://ghost.org/zip/ghost-latest.zip
PROJ_DIR=$(pwd)
TMP_DIR=$(mktemp -d -t ghost)