Skip to content

Instantly share code, notes, and snippets.

Avatar

Ben Kreeger kreeger

View GitHub Profile
@kreeger
kreeger / steam-big-picture-1080p.bat
Last active Apr 23, 2021
Two batch scripts for launching Steam in a specific resolution for streaming to a TV or iPad -- necessary to get the aspect ratio right if your primary PC display is not 16:9 or 16:10. Requires https://tools.taubenkorb.at/change-screen-resolution/
View steam-big-picture-1080p.bat
C:\Applications\ChangeScreenResolution.exe /w=1920 /h=1080 /d=0
"C:\Program Files (x86)\Steam\steam.exe" -start "steam://open/bigpicture"
TIMEOUT /T 3
C:\Applications\ChangeScreenResolution.exe /w=3440 /h=1440 /d=0
@kreeger
kreeger / Kreeger.3.0.binds
Created Apr 19, 2021
Elite Dangerous: Horizons keybinds (as of the Fleet Carrier update).
View Kreeger.3.0.binds
<?xml version="1.0" encoding="UTF-8" ?>
<Root PresetName="Kreeger" MajorVersion="3" MinorVersion="0">
<KeyboardLayout>en-US</KeyboardLayout>
<MouseXMode Value="" />
<MouseXDecay Value="0" />
<MouseYMode Value="" />
<MouseYDecay Value="0" />
<MouseReset>
<Primary Device="{NoDevice}" Key="" />
<Secondary Device="{NoDevice}" Key="" />
@kreeger
kreeger / Kreeger.4.0.binds
Last active Apr 19, 2021
Elite Dangerous: Odyssey keybinds (as of Alpha 3).
View Kreeger.4.0.binds
<?xml version="1.0" encoding="UTF-8" ?>
<Root PresetName="Kreeger" MajorVersion="4" MinorVersion="0">
<KeyboardLayout>en-US</KeyboardLayout>
<MouseXMode Value="" />
<MouseXDecay Value="0" />
<MouseYMode Value="" />
<MouseYDecay Value="0" />
<MouseReset>
<Primary Device="{NoDevice}" Key="" />
<Secondary Device="{NoDevice}" Key="" />
@kreeger
kreeger / kinto.py
Created Aug 2, 2020
My configuration for https://github.com/rbreaves/kinto (the default seems to switch Alt and Super/Cmd)
View kinto.py
# -*- coding: utf-8 -*-
import re
from xkeysnail.transform import *
# Use the following for testing terminal keymaps
# terminals = [ "", ... ]
# xbindkeys -mk
terminals = ["gnome-terminal","konsole","io.elementary.terminal","terminator","sakura","guake","tilda","xterm","eterm","kitty","alacritty","mate-terminal","tilix","xfce4-terminal"]
terminals = [term.casefold() for term in terminals]
@kreeger
kreeger / HTTPRecording.swift
Created Dec 27, 2019
A convenient way to mock out URL requests in Swift tests.
View HTTPRecording.swift
//
// HTTPRecording.swift
//
import Foundation
struct HTTPRecording {
let statusCode: Int
let httpVersion: String
let headers: [String: String]
View cloudSettings
{"lastUpload":"2020-12-06T16:53:14.349Z","extensionVersion":"v3.4.3"}
@kreeger
kreeger / bootstrap-macOS.sh
Last active Feb 26, 2021
A script for bootstrapping a new Mac.
View bootstrap-macOS.sh
#!/usr/bin/env bash
#
# bootstrap-macOS.sh
# Install Xcode, make sure Mackup's files are downloaded, and then run this script.
#
# Install Xcode command line tools.
sudo xcode-select --install
View keybase.md

Keybase proof

I hereby claim:

  • I am kreeger on github.
  • I am kreeger (https://keybase.io/kreeger) on keybase.
  • I have a public key whose fingerprint is 65B5 0868 E045 FAEE E978 139E 876B 0A70 25B3 B62D

To claim this, I am signing this object:

@kreeger
kreeger / linux-bootstrap.sh
Last active Jan 26, 2019
Future machine setup. Run as root.
View linux-bootstrap.sh
# Update apt and such
apt update
apt upgrade -y
apt dist-upgrade -y
# Add apt keys
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | apt-key add -
wget -q https://download.sublimetext.com/sublimehq-pub.gpg -O- | apt-key add -
@kreeger
kreeger / DataSourceUsage.swift
Created Jan 8, 2019
Example data source usage code for the blog post "Flapjack" on O'Reilly's engineering blog.
View DataSourceUsage.swift
let dataSourceFactory = CoreDataSourceFactory(dataAccess: dataAccess)
let queryAttributes = ["radius": 2.0, "flavor": "Chocolate Chip"]
let dataSource: CoreDataSource<Pancake> = dataSourceFactory.vendObjectsDataSource(attributes: queryAttributes, sectionProperty: "flavor", limit: 100)
// Prepare yourself for pancakes, but only chocolate chip ones bigger than a 2" radius, and no more than 100.
// This block fires every time the data source picks up an insert/change/deletion.
dataSource.onChange = { itemChanges, sectionChanges in
// If you've added `Flapjack/UIKit` to your Podfile, you get helper extensions!
self.tableView.performBatchUpdates(itemChanges, sectionChanges: sectionChanges)
// Get a specific pancake:
print("\(String(describing: dataSource.object(at: IndexPath(item: 0, section: 0))))")