Skip to content

Instantly share code, notes, and snippets.

🦊
Fox familiar.

Ken Keiter kenkeiter

🦊
Fox familiar.
View GitHub Profile
@kenkeiter
kenkeiter / markdown_to_pdf.py
Created Oct 17, 2019
Quick markdown file to PDF routine.
View markdown_to_pdf.py
import os
import markdown
from markdown_include.include import MarkdownInclude
import weasyprint
from mako.template import Template
HTML_BOILERPLATE_TEMPLATE = """
<html>
<head>
<style>{css}</style>
View Dockerfile
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
make \
file \
curl \
ca-certificates \
python2.7 \
git \
View twitter.css
.js-moments-tab {
display: none !important;
}
.wtf-module {
display: none !important;
}
.LiveVideoHomePageModuleContainer {
display: none !important;
@kenkeiter
kenkeiter / hktypes.swift
Created Apr 15, 2017
A full set of all HKObjectTypes (excluding correlation types, as of Apr. 15, 2017) because typing this out was a pain in the ass.
View hktypes.swift
let hkTypes:Set<HKObjectType> = [
// body measurements
HKObjectType.quantityType(forIdentifier: .bodyMassIndex)!,
HKObjectType.quantityType(forIdentifier: .bodyFatPercentage)!,
HKObjectType.quantityType(forIdentifier: .height)!,
HKObjectType.quantityType(forIdentifier: .bodyMass)!,
HKObjectType.quantityType(forIdentifier: .leanBodyMass)!,
// fitness identifiers
HKObjectType.quantityType(forIdentifier: .stepCount)!,
HKObjectType.quantityType(forIdentifier: .distanceWalkingRunning)!,
View Non_North_America_Fulfillment_Centers.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kenkeiter
kenkeiter / impbcopy.m
Last active Sep 17, 2017
Take a selfie, archive it, and copy it to the clipboard -- all from the terminal! (bash + os x)
View impbcopy.m
/////////////////////////////////////////////////////////
// Copied from http://www.alecjacobson.com/weblog/?p=3816
/////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <unistd.h>
BOOL copy_to_clipboard(NSString *path)
{
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage
NSImage * image;
View index.html
<!--
The MIT License (MIT)
Copyright (c) 2013 bill@bunkat.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@kenkeiter
kenkeiter / storage.md
Last active Aug 29, 2015
Small + Low Power Storage for Max
View storage.md

Did my best to find a quick/cheap platform you can experiment with. This is an example of an underpowered SoC. Even though the board itself supports SATA 2.5, USB 3, and Gig-E, the CPU can't. Obviously, it doesn't fulfill your needs, but you can run benchmarks to figure out what you actually need based upon it.

@kenkeiter
kenkeiter / lmutracker.mm
Last active Apr 20, 2017
Read lux measurement using MBP ambient light sensor.
View lmutracker.mm
// lmutracker.mm -- Provides lux measurement using MacBook Ambient Light Sensor
//
// clang -o lmutracker lmutracker.mm -framework IOKit -framework CoreFoundation
//
// Adaptation of code originally posted at https://bugzilla.mozilla.org/show_bug.cgi?id=793728
// by Reuben Morais. Modified by Ken Keiter <ken@kenkeiter.com> to output a single *lux* value
// and exit, rather than repeating measurements on the sensor's arbitrary scale.
#include <mach/mach.h>
#include <math.h>
@kenkeiter
kenkeiter / homebrew_yosemite_valgrind.txt
Created Oct 20, 2014
Homebrew output when building valgrind on Yosemite.
View homebrew_yosemite_valgrind.txt
~ → brew install valgrind
valgrind: OS X Mavericks or older is required for stable.
Use `brew install devel or --HEAD` for newer.
Error: An unsatisfied requirement failed this build.
~ → brew edit valgrind
~ → brew install valgrind
==> Downloading http://valgrind.org/downloads/valgrind-3.10.0.tar.bz2
######################################################################## 100.0%
==> Downloading https://gist.githubusercontent.com/jacknagel/369bedc191e0a0795358/raw/a71e6c0fdcb786fdfde2fc33d71d555b18
######################################################################## 100.0%
You can’t perform that action at this time.