Skip to content

Instantly share code, notes, and snippets.

@command-tab
command-tab / collinsolas.sh
Created October 23, 2014 05:56
Collinsolas.sh: Fix Microsoft's broken Consolas font metrics
#!/bin/bash
# Based in part on https://wincent.com/wiki/Fixing_the_baseline_on_the_Consolas_font_on_OS_X
function fail()
{
local error=${1:-Unknown error}
echo "Failed! $error"
exit 1
}
@command-tab
command-tab / safari_gripes.md
Last active August 29, 2015 14:23
Safari Gripes

Note: I'm a web developer, so it's likely that the software behaviors that bother me are unlikely to affect non-web-developers.

  • Clicking the address bar makes the web address slide to the left to appear like normal editable text field. If I'm clicking in a specific spot to edit the web address, I have to move my mouse again to highlight the portion I wanted, since the whole contents of the field slid leftward upon click. If the address bar wasn't weirdly centered to begin with, the sliding wouldn't be necessary.
  • The address bar is centered and doesn't fill up the width of the hybrid title bar/toolbar. Even removing the Flexible Space toolbar items that are present on either side doesn't make the bar expand to fill the available space. This is inconsistent with the behavior of Flexible Space toolbar items found elsewhere in OS X.
  • I'd like to be able to disable the Favorites icon menu that appears when the address bar is clicked. Combined with the address sliding, there's an awful lot of animation goin
@command-tab
command-tab / index.js
Created August 3, 2018 03:54
Using Apollo Server 2 with GraphiQL instead of GraphQL Playground
const express = require('express');
const { ApolloServer, gql } = require('apollo-server-express');
const graphqlHTTP = require('express-graphql');
const typeDefs = gql`
type Query {
hello: String
}
`;
@command-tab
command-tab / index.js
Created August 4, 2018 04:04
Customizing Apollo Server 2.0 GraphQL Playground path
const express = require('express');
const { ApolloServer, gql } = require('apollo-server-express');
const { typeDefs, resolvers } = require('./schema');
// https://www.apollographql.com/docs/apollo-server/features/graphql-playground.html#Enabling-GraphQL-Playground-in-production
const server = new ApolloServer({
typeDefs,
resolvers,
introspection: true,
playground: {
@command-tab
command-tab / edgetest.py
Created June 6, 2019 17:21
RPi GPIO interrupt handling
#!/usr/bin/env python3
import RPi.GPIO as GPIO
import asyncio
import sys
PIN = 18
def handle_edge(pin):
print('Edge callback')
@command-tab
command-tab / irixswextract.c
Created April 30, 2020 05:26 — forked from camthesaxman/irixswextract.c
tool to extract IRIX software packages
#include <ctype.h>
#include <errno.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
struct Archive
$ cargo n64 build --ipl3 ./ipl3.bin --package hello-ipl3font
Building with cargo xbuild
Updating crates.io index
Compiling compiler_builtins v0.1.28
Compiling core v0.0.0 (/Users/me/.rustup/toolchains/nightly-2020-02-16-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore)
Compiling rustc-std-workspace-core v1.99.0 (/Users/me/.rustup/toolchains/nightly-2020-02-16-x86_64-apple-darwin/lib/rustlib/src/rust/src/tools/rustc-std-workspace-core)
error[E0635]: unknown feature `llvm_asm`
--> /Users/me/.cargo/registry/src/github.com-1ecc6299db9ec823/compiler_builtins-0.1.28/src/lib.rs:3:12
|
3 | #![feature(llvm_asm)]
$ rustc --version
rustc 1.45.0-nightly (a74d1862d 2020-05-14)
$ cargo xbuild --version
cargo-xbuild 0.5.31
$ cargo n64 build --ipl3 ipl3.bin --package hello-ipl3font --verbose
Building with cargo xbuild
+ "cargo" "xbuild" "--message-format=json" "--target=/var/folders/j3/7pf540td3xncn7jdqtb62_ph00058y/T/n64-build/mips-nintendo64-none.json" "--package" "hello-ipl3font" "--verbose" "--release"
WARNING: There is no root package to read the cargo-xbuild config from.
#/usr/bin/env python
# "SMAKN LCUS-1 type USB relay module USB intelligent control switch USB switch"
# https://www.amazon.com/gp/product/B01CN7E0RQ/
# pipenv install pyserial
import serial
import time
@command-tab
command-tab / webrtc-build.md
Created September 1, 2020 21:23
Building WebRTC.framework from master on macOS
cd webrtc_build
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
export PATH=`pwd`/depot_tools:"$PATH"
fetch --nohooks webrtc_ios
gclient sync
git new-branch master-build

gn gen out/ios_sim --args='target_os="ios" target_cpu="x64" is_debug=false ios_enable_code_signing=false'
gn gen out/ios_64 --args='target_os="ios" target_cpu="arm64" is_debug=false ios_enable_code_signing=false'