Skip to content

Instantly share code, notes, and snippets.

@mogenson
mogenson / debian-9360-install-notes.md
Last active April 5, 2020 01:59
Installing Debian Stretch + Mate + i3-gaps on a Dell XPS 9360

Installation and setup notes for Debian 9 on Dell XPS 9360

Using Mate DE and i3-gaps WM

May 4th 2017

Installation

Use Debian Stretch RC3 Installer: https://www.debian.org/devel/debian-installer/

  • Non-graphical install
  • Ignore warning about firmware not found for wireless card
@mogenson
mogenson / JLinkExe.txt
Last active May 22, 2017 18:21
JLinkExe commands to program nrf51822
J-Link>device nrf51822_xxAA
J-Link>speed 1000
J-Link>if SWD
J-Link>connect
J-Link>r
# erase the entire flash
J-Link>w4 4001e504 2
J-Link>w4 4001e50c 1
J-Link>w4 4001e514 1
J-Link>r
@mogenson
mogenson / pocket-2-arch-install.md
Last active September 28, 2018 14:25
Pocket 2 Arch Linux Installation Guide

GPD Pocket 2 Arch Linux Installation Guide

This following instructions install Arch Linux on a GPD Pocket 2. This installation uses systemd for boot. It sets up a 30GB root partition and an encrypted user partition that is decrypted and mounted on login. Let's get started.

Download and write the Arch Linux installation ISO to a flash drive. Insert flash drive, press power, hold F12, and select flash drive to boot.

Rotate console:
echo 1 > /sys/class/graphics/fbconv/rotate_all

Connect to Wi-Fi:

unmap("b");
map("b", "S");
map("m", "d");
map(",", "e");
map("H", "E");
map("L", "R");
@mogenson
mogenson / get-speed-limit.py
Created March 8, 2019 19:50
Query speed limit for latitude longitude. Example for I-93: ./get-speed-limit.py 42.589634 -71.163586
#!/usr/bin/env python3
import requests
import sys
import re
# parse command line arguements
if len(sys.argv) != 3:
print("Usage: {} latitude longitude".format(sys.argv[0]))
sys.exit()
@mogenson
mogenson / dell-5530-arch-install.md
Last active August 26, 2019 16:25
Dell 5530 Arch Linux Installation Guide

Dell 5530 Arch Linux Installation Guide

This following instructions install Arch Linux on a Dell 5530 laptop. This installation uses systemd for boot. It sets up a 30GB root partition and an encrypted user partition that is decrypted and mounted on login. Let's get started.

Base installation

Download and write the Arch Linux installation ISO to a flash drive. Insert flash drive, press power, hold F12, and select flash drive to boot.

Set system clock:
timedatectl set-ntp true

@mogenson
mogenson / enums.dart
Last active August 29, 2019 18:35
dart enum problem
class EnumType {
static const int one = 1;
}
void printEnum(EnumType number) {
print(number);
}
void main() {
printEnum(EnumType.one);
@mogenson
mogenson / main.c
Last active December 15, 2019 22:05
Example: default value for optional macro argument
/* Copyright (c) 2019 Michael Mogenson
* MIT license https://opensource.org/licenses/MIT
*/
/* This contrived example demonstrates the use of the comma operator and
* variadic arguments to create a function-like macro that accepts an optional
* argument and provides a default value when no argument is supplied.
*
* C's comma operator will evaluate the statement to the left of the comma and
* return the value of the statement to the right. The line `if (i++, true)` is
@mogenson
mogenson / color-clock.sh
Created March 2, 2020 02:02
A bash script to change the color of a Philips Wiz WiFi light bulb throughout the day
#!/bin/bash
IP=192.168.86.24
PORT=38899
while :
do
HOURS=$(date +"%-H")
MINUTES=$(date +"%-M")
MINUTES=$(($HOURS * 60 + $MINUTES))
@mogenson
mogenson / shell.nix
Created July 15, 2021 18:17
Nix shell to build CircuitPython on MacOS
{ pkgs ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz") { }
, pkgs_x86_64 ? import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/refs/tags/21.05.tar.gz") { localSystem = "x86_64-darwin"; }
}:
with pkgs.python38Packages;
let
cascadetoml = buildPythonPackage rec {
pname = "cascadetoml";
version = "0.3.0";
src = fetchPypi {