Skip to content

Instantly share code, notes, and snippets.

View porty's full-sized avatar

Robert McNeil porty

View GitHub Profile
@ihnorton
ihnorton / bouncywin.swift
Last active December 9, 2019 20:51
Bouncy window manager "solution" (screen capture at bottom)
import Cocoa
import Foundation
import AppKit
import CoreFoundation
import ApplicationServices
/// https://jvns.ca/blog/2019/11/25/challenge--make-a-bouncy-window-manager/
/*
This code runs the following sequence:

Everything I Know About UI Routing

Definitions

  1. Location - The location of the application. Usually just a URL, but the location can contain multiple pieces of information that can be used by an app
    1. pathname - The "file/directory" portion of the URL, like invoices/123
    2. search - The stuff after ? in a URL like /assignments?showGrades=1.
    3. query - A parsed version of search, usually an object but not a standard browser feature.
    4. hash - The # portion of the URL. This is not available to servers in request.url so its client only. By default it means which part of the page the user should be scrolled to, but developers use it for various things.
    5. state - Object associated with a location. Think of it like a hidden URL query. It's state you want to keep with a specific location, but you don't want it to be visible in the URL.
@jessfraz
jessfraz / boxstarter.ps1
Last active October 12, 2025 03:18
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <[email protected]>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@marcan
marcan / linux.sh
Last active July 26, 2025 08:39
Linux kernel initialization, translated to bash
#!/boot/bzImage
# Linux kernel userspace initialization code, translated to bash
# (Minus floppy disk handling, because seriously, it's 2017.)
# Not 100% accurate, but gives you a good idea of how kernel init works
# GPLv2, Copyright 2017 Hector Martin <[email protected]>
# Based on Linux 4.10-rc2.
# Note: pretend chroot is a builtin and affects the current process
# Note: kernel actually uses major/minor device numbers instead of device name
@jordanorelli
jordanorelli / ps.go
Created December 17, 2016 05:02
list running processes on windows via kernel32.dll and CreateToolhelp32Snapshot
package main
import (
"fmt"
"syscall"
"unicode/utf16"
"unsafe"
)
const invalidHandle = ^uintptr(0)
@peterhellberg
peterhellberg / evdev-bobblehat.go
Created September 18, 2016 11:58
How to use the Raspberry Pi Sense HAT Joystick using golang-evdev
package main
import (
"flag"
"fmt"
"os"
"os/signal"
evdev "github.com/gvalkov/golang-evdev"
screen "github.com/nathany/bobblehat/sense/screen"
@ajfisher
ajfisher / _brexit.md
Last active June 27, 2016 01:03
A quick little slack bot to report of brexit results

This is a little slack bot I made which is used to get results for the EU Referendum in the UK

Set up

npm install cheerio botkit request

Log into slack, create a new bot and then get the token for it.

Drop the token into the brexitbot.js file where it says "PUT YOUR TOKEN HERE"

@nathan-osman
nathan-osman / win32.go
Last active September 11, 2025 02:32
Simple Windows GUI application written in Go
package main
import (
"log"
"syscall"
"unsafe"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")
// +build windows
package screen
import (
"fmt"
"image"
"reflect"
"syscall"
"unsafe"
function dgryski-set-prompt {
if [ $(tput colors) -ge 8 ]; then
BRED='\[\e[1;31m\]'
RED='\[\e[0;31m\]'
BGREEN='\[\e[1;32m\]'
GREEN='\[\e[0;32m\]'
BYELLOW='\[\e[1;33m\]'
YELLOW='\[\e[0;33m\]'
BBLUE='\[\e[1;34m\]'