Skip to content

Instantly share code, notes, and snippets.

View mhansen's full-sized avatar
🏠
Trying

Mark Hansen mhansen

🏠
Trying
View GitHub Profile
@mhansen
mhansen / index.html
Created January 4, 2026 04:35
Terminal output HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Terminal Output</title>
</head>
<body style="background: black; color: white; margin: 0; padding: 5px;">
<pre>
███ █████████ ██████████ ██████ ██████ █████ ██████ █████ █████
@mhansen
mhansen / index.html
Created January 4, 2026 04:14
Terminal output HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Terminal Output</title>
</head>
<body style="background: black; color: white; margin: 0; padding: 5px;">
<pre>
███ █████████ ██████████ ██████ ██████ █████ ██████ █████ █████
@mhansen
mhansen / prompt.html
Created January 4, 2026 04:13
Fixing a nzwirelessmap issue
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Terminal Output</title>
</head>
<body style="background: black; color: white; margin: 0; padding: 5px;">
<pre>
███ █████████ ██████████ ██████ ██████ █████ ██████ █████ █████
@mhansen
mhansen / angles.js
Created May 7, 2018 11:36
Calculate whether a difference in angle is clockwise or anticlockwise.
function isClockwise(from, to) {
let diff = normalize(from) - normalize(to);
return normalize(diff) > 180;
}
// Returns angle normalized to between [0, 360).
function normalize(angle) {
while (angle < 0) {
angle += 360;
}
@mhansen
mhansen / keepassx_to_1password.py
Last active October 27, 2017 09:42
Converts from KeepassX exported CSV to 1Password CSV
import pandas
f = pandas.read_csv("keepass_export.csv")
f = f[f["Group"] != "Root/Recycle Bin"]
f2 = pandas.DataFrame()
f2["title"] = f["Title"]
f2["website"] = f["URL"]
f2["username"] = f["Username"]
f2["password"] = f["Password"]
f2["notes"] = f["Notes"]
@mhansen
mhansen / s.c
Created December 4, 2012 13:11
Three sorting algorithms, in C
#include <stdio.h>
#include <string.h>
void swap(char* a, char* b) {
char t = *a;
*a = *b;
*b = t;
}
void bubblesort(char* s, int n) {
import pygame
# Game variables
my_dudes_x_position = 300
bullets = []
window = pygame.display.set_mode((640, 480))
clock = pygame.time.Clock()
def clear_the_screen():
<Point><coordinates>176.0837184,-38.7152427</coordinates></Point> 8 <h1>TWO MILE BAY</h1><h2>Broadcasts</h2><ul><li>tx: MOBILE<br>150.6875<br>SELF LOADER LOGGING</li><li>tx: MOBILE<br>153.55625<br>SELF LOADER LOGGING</li><li>tx: MOBILE<br>150.8375<br>SELF LOADER LOGGING</li><li>tx: MOBILE<br>150.8625<br>SELF LOADER LOGGING</li><li>tx: MOBILE<br>153.53125<br>SELF LOADER LOGGING</li></ul>
import ij.ImagePlus;
import ij.plugin.filter.PlugInFilter;
import ij.process.ImageProcessor;
public class My_Inverter implements PlugInFilter {
public int setup(String arg, ImagePlus im) {
return DOES_8G; // this plugin only works on 8-bit grayscale images
}
public void run(ImageProcessor ip) {
{
"album": {
"#text": "The System is a Vampire",
"mbid": ""
},
"artist": {
"#text": "Shapeshifter",
"mbid": "40d1d78f-6b66-4b14-b8c8-f13786a8cf4f"
},
"date": {