Skip to content

Instantly share code, notes, and snippets.

Avatar
🔐
All your bits belong to me

Ian Spence ecnepsnai

🔐
All your bits belong to me
View GitHub Profile
@ecnepsnai
ecnepsnai / main.go
Created Nov 8, 2020
Simple go app to organize files with dates into subdirs of those dates
View main.go
package main
import (
"fmt"
"io/ioutil"
"os"
"path"
"regexp"
"strings"
)
View resource.5s.rb
#!/usr/bin/ruby
# <bitbar.title>Resources</bitbar.title>
# <bitbar.version>v1.1</bitbar.version>
# <bitbar.author>Ian Spence</bitbar.author>
# <bitbar.author.github>ecnepsnai</bitbar.author.github>
# <bitbar.desc>Show overall CPU and Memory Usage with colors. Keep it simple, stupid!</bitbar.desc>
# <bitbar.dependencies>ruby</bitbar.dependencies>
cpu_count = `sysctl -n hw.logicalcpu`.chomp().to_f
total = `ps -Ao %cpu= | paste -sd+ - | bc`.chomp().to_f
@ecnepsnai
ecnepsnai / thesims2.md
Created Jun 22, 2020
Getting the Sims 2 to run on Windows 10
View thesims2.md

Does The Sims 2 work on Windows 10?

Yes! The game runs just fine on Windows 10 on new hardware (Such as a AMD Ryzen and a GeForce RTX)

So then what's the problem?

The problem is updating the Sims 2.

It's hard to picture now, but when the Sims 2 came out EA knew that not everybody had reliable internet, if they even had internet at all. The Sims 2 base game was for many people the ONLY version of the game they could get.

@ecnepsnai
ecnepsnai / service_monitor.sh
Created Feb 19, 2020
Systemd Unit Discord Monitor
View service_monitor.sh
#!/bin/bash
# Usage:
# $ DISCORD_WEBHOOK_URL=<Webhook URL> ./service_monitor.sh <SystemD Unit Name>
UNIT_NAME=$1
STATE_FILE="~/.${UNIT_NAME}_last_state"
function get_current_state {
(systemctl is-active --quiet ${UNIT_NAME})
@ecnepsnai
ecnepsnai / zfs_backup_restore.md
Last active Sep 9, 2020
Backup & Restore ZFS to External USB Drive
View zfs_backup_restore.md

Backup

1. Take a snapshot

Take a snapshot of the zpool you wish to backup

zfs snapshot tank@backup-jan-2020
@ecnepsnai
ecnepsnai / setup.md
Last active Jul 21, 2020
Windows 10 New PC Setup
View setup.md

Windows 10 New PC Setup

The Basics

Local account only

Don't link a local workstation account with an online account.

For Windows 10 Home, during OOBE do not connect to a network (Click "I don't have internet"), otherwise you are forced to use a Microsoft account. Windows 10 Pro installs give you the choice even if you do connect to the internet.

@ecnepsnai
ecnepsnai / update_go.sh
Created Apr 9, 2019
Script to manage go versions easily
View update_go.sh
#!/bin/bash
set -e
VERSION=${1:?Version Required}
INSTALL_DIR="/usr/local/go"
if [[ ! -d ${INSTALL_DIR} ]]; then
mkdir -p ${INSTALL_DIR}
fi
VERSION_DIR="${INSTALL_DIR}/${VERSION}"
@ecnepsnai
ecnepsnai / settings.json
Last active May 2, 2020
VSCode Settings
View settings.json
{
"workbench.colorTheme": "One Dark Pro",
"workbench.iconTheme": "material-icon-theme",
"editor.fontSize": 13,
"editor.fontFamily": "JetBrains Mono",
"window.zoomLevel": -1,
"go.testOnSave": false,
"go.liveErrors": {
"enabled": true,
"delay": 500
@ecnepsnai
ecnepsnai / install.sh
Created Jan 5, 2019
Install Go Report Card
View install.sh
#!/bin/bash
go get github.com/gojp/goreportcard/cmd/goreportcard-cli
go get github.com/alecthomas/gometalinter
go get github.com/fzipp/gocyclo
go get github.com/gordonklaus/ineffassign
go get github.com/client9/misspell/cmd/misspell
@ecnepsnai
ecnepsnai / ocsp.c
Created Feb 24, 2018
Get OCSP URI from Certificate
View ocsp.c
X509 * cert;
AUTHORITY_INFO_ACCESS * info = X509_get_ext_d2i(cert, NID_info_access, NULL, NULL);
int len = sk_ACCESS_DESCRIPTION_num(info);
for (int i = 0; i < len; i++) {
// Look for the OCSP entry
ACCESS_DESCRIPTION * description = sk_ACCESS_DESCRIPTION_value(info, i);
if (OBJ_obj2nid(description->method) == NID_ad_OCSP) {
if (description->location->type == GEN_URI) {
char * ocspurlchar = i2s_ASN1_IA5STRING(NULL, description->location->d.ia5);
You can’t perform that action at this time.