Skip to content

Instantly share code, notes, and snippets.

View sinewalker's full-sized avatar

Michael Lockhart sinewalker

View GitHub Profile
@sinewalker
sinewalker / win-timezone-information.reg
Last active January 27, 2023 09:09
Make Windows 7+ use UTC Real-time-clock
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001
@sinewalker
sinewalker / shrug.txt
Created October 19, 2017 01:45
shrug
¯\_(ツ)_/¯
@sinewalker
sinewalker / gpg-cheats.md
Last active September 23, 2017 02:07
GPG Cheat Sheet

Quick'n easy gpg cheatsheet

Just a brief explanation of some of the command line functionality from gnu privacy guard (gpg).

-- Originaly from http://irtfweb.ifa.hawaii.edu/~lockhart/gpg/ (no relation)

Create a key:

gpg --gen-key generally you can select the defaults.

@sinewalker
sinewalker / rpsls.md
Last active February 5, 2018 09:14
Rock, Paper, Scissors, Lizard, Spock

Rock, Paper, Scissors, Lizard, Spock

  • Scissors cut Paper

  • Paper covers Rock

  • Rock crushes Lizard

  • Lizard poisons Spock

  • Spock smashes Scissors

  • Scissors decapitate Lizard

@sinewalker
sinewalker / accellerologger.ino
Last active September 9, 2017 10:02
EJBlogger's Accellerologger code
#include <SparkFun_ADXL345.h>
#include <SD.h>
#include <SPI.h>
//ADXL345 adxl = ADXL345(10); For SPI Cumunication
ADXL345 adxl = ADXL345();
File myFile;
const int threshold = 1499;
const int switchPin = 7;
int switchState;
@sinewalker
sinewalker / copy-mc-saves.md
Last active September 7, 2017 21:15
Steps for copying Minecraft saves to a PC

Steps for copying Minecraft saves to a PC

(There's more of this Gist than will fit in the preview. Click on it to see the whole thing)

First, open, play and then quit Minecraft at least once; to make a .minecraft appdata folder)

  1. Open Windows Explorer (press Win+R, then type explorer)
  2. Go to the %appdata% directory. There should be a folder called .minecraft listed
  3. Open the .minecraft folder. There should be a saves folder in it.
@sinewalker
sinewalker / appdata.md
Last active January 6, 2018 21:46
Temporarily change %APPDATA% for portable settings (Windows: e.g. Minecraft)

Need to take %APPDATA% directory data to another PC? For example Minecraft game saves to take in to a school for projects, or to a friend's house. The tricky part is: %APPDATA% has a different location depending on the version of Windows. Yay Microsoft, thanks once again.

The good news is that many Windows programs do use the environment variable to locate this folder, so you can just override it and launch your game or whatever from a .cmd / .bat file.

In the case of Minecraft on a USB:

  1. Make a folder structure on the USB drive for it (assume E: is the USB):
    • E:\Minecraft
    • E:\Minecraft\bin
  • E:\Minecraft\data
@sinewalker
sinewalker / count-cpus.md
Last active August 25, 2017 21:55
counting CPUs on Linux

I was using this pipeline:

grep -c processor /proc/cpuinfo

However there's a better way: nproc

and for a good summary of CPU info from /sys and /proc/cpuinfo use lscpu which has options to produce parseable output for pipelines.

@sinewalker
sinewalker / unixdates.md
Last active January 27, 2023 04:40
Unix Epoch conversion

Convert a Unix timestamp into human-readable format:

  • GNU: date -date='@1501768813'
  • BSD: date -r 1501768813

Convert the other way

  • Current date/time as Unix timestamp: date +%s

  • A specific date/time (assumes current timezone):

@sinewalker
sinewalker / check-required-utilities.sh
Last active May 18, 2021 00:40
Checking a bash script's requirements are met by the host OS
# required utilities
required=(
grep
awk
curl
jq
)
missing=()