Skip to content

Instantly share code, notes, and snippets.

View jennings's full-sized avatar
🦄
What a mess I've made

Stephen Jennings jennings

🦄
What a mess I've made
View GitHub Profile
@jennings
jennings / 1_Relational_text_processing.md
Last active December 7, 2020 16:08
Unix relational text processing

sort

Sorts on a column.

$ sort makes.txt
1 volkswagen
2 honda
3 ford

Fundamental Principle

Systems in general work poorly or not at all.

First Principles

  1. New Systems mean new problems.
  2. The total amount of anergy in the universe is fixed.
  3. Systems tend to expand to fill the known universe.

Download PuTTY

Download and install the latest 64-bit PuTTY. Using the MSI is fine.

Generate an SSH key

Each computer should a unique SSH key. The same key can be reused for GitHub, Bitbucket, and any other Git server you connect to.

  1. Launch PuTTYgen:
  2. Select "Ed25519"
function Caffeinate {
param([scriptblock]$ScriptBlock)
$active_scheme_id = (powercfg /GetActiveScheme).Split(" ")[3]
$high_perf_id = "8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"
powercfg /s $high_perf_id
if ($LASTEXITCODE -ne 0) { return }
try {
& $ScriptBlock
} finally {
@jennings
jennings / rx-net-vs-rxjs.md
Last active December 19, 2019 19:43
A cheatsheet of Rx.NET to rxjs operators

Creation

System.Reactive rxjs 6
Observable.Return import { of } from "rxjs"
Observable.Empty import { EMPTY } from "rxjs"
Observable.Never import { NEVER } from "rxjs"
Observable.Throw import { throwError } from "rxjs"
Observable.Create new Observable(observer => {})
Observable.Range import { range } from "rxjs"
$ErrorActionPreference = "Stop"
function Main {
"This script creates a zip file that contains all files changed between two commits."
"Commits can be specified as commit IDs (SHA) or as branch names."
"For example: 'master' or 'ff39683ed6'"
""
$git_dir = Read-Host -Prompt "Git directory"
$to_commit = Read-Host -Prompt "Commit to deploy"
@jennings
jennings / README.md
Last active May 2, 2019 18:09
Templates for empty new-style csproj files

These are copied from this article by Nate McMaster. I've been Googling for it every time I needed it, so I decided it would be a good idea to save these templates somewhere, in case the article ever goes away.

const MODULE_BODIES = {
// This is the body of the file foo/index.ts, wrapped in a function
["./foo/index.ts"]: function (module) {
const file = __webpack_resolve__("./foo/file.ts")
module.exports.Service = file.Service
},
// This is the body of the file foo/file.ts, wrapped in a function
["./foo/file.ts"]: function (module) {
@jennings
jennings / ArchLinuxArmPi3.md
Last active March 3, 2019 00:58
Arch Linux ARM setup for Raspberry Pi 3
#define NONEST
void Main()
{
Database.SetInitializer<MyContext>(null);
using (var db = new MyContext())
{
var date = "20180315";
var query = from row in db.Tabl1
where SqlFunctions.DateDiff(