Skip to content

Instantly share code, notes, and snippets.

@ryantanner
ryantanner / README.md
Created March 13, 2020 17:51
Creating a "hot mic" icon with BetterTouchTool

This describes how to create a hot mic icon in the Touch Bar, like this: https://twitter.com/youfoundryan/status/1238507646677700608

  1. Install BetterTouchTool (https://folivora.ai/)
  2. Create a new Touch Bar widget of type "Apple Script/Javascript Widget". You don't need a trigger.
  3. Paste the contents of mic_state.scpt into the script box.
  4. Set the "Alternate Color Regex" to "off".
  5. Switch to the "common" widget settings pane. Set the button background color to red. Set the "Select Button Icon" to the mic and the "Alternate Button Icon" to the mic with a line through it.
  6. Check "show only icon, no text"

I also assigned a FN key on my external keyboard to toggle the mic:

case object Hello
case object Howdy
case object GetCount
case class HelloCount(count: Int)
class HelloActor extends Actor {
var count = 0
def receive = {
@ryantanner
ryantanner / poker.scala
Last active December 3, 2015 17:35
First pass at using Shapeless to describe Texas Hold'em. Pocket hand categories are based on Lee Jones' "Winning Texas Hold'em"
package org.ryantanner
import scala.annotation.implicitNotFound
import shapeless._
import Nat._
import ops.nat._
import LTEq._
import GTEq._
import RankGTEq._
/**
* To get started:
* git clone https://github.com/twitter/algebird
* cd algebird
* ./sbt algebird-core/console
*/
/**
* Let's get some data. Here is Alice in Wonderland, line by line
*/
Mar 20 17:22:22 ip-10-0-0-91.us-east-1.compute.internal systemd[1]: Starting docker container 0059525419ee59f85914c38825009fef6ad7e317d66ac984c9e71229e1fdb39a.
Mar 20 17:22:22 ip-10-0-0-91.us-east-1.compute.internal systemd[1]: Started docker container 0059525419ee59f85914c38825009fef6ad7e317d66ac984c9e71229e1fdb39a.
Mar 20 17:22:22 ip-10-0-0-91.us-east-1.compute.internal kernel: device veth08bf4ef entered promiscuous mode
Mar 20 17:22:22 ip-10-0-0-91.us-east-1.compute.internal kernel: IPv6: ADDRCONF(NETDEV_UP): veth08bf4ef: link is not ready
Mar 20 17:22:22 ip-10-0-0-91.us-east-1.compute.internal systemd-networkd[465]: veth08bf4ef : link configured
Mar 20 17:22:22 ip-10-0-0-91.us-east-1.compute.internal kernel: eth0: renamed from veth1b4dbf6
Mar 20 17:22:22 ip-10-0-0-91.us-east-1.compute.internal systemd-networkd[465]: veth08bf4ef : gained carrier
Mar 20 17:22:22 ip-10-0-0-91.us-east-1.compute.internal kernel: IPv6: ADDRCONF(NETDEV_CHANGE): veth08bf4ef: link becomes ready
Mar 20 17:22:22 ip-10-0-0-91
@ryantanner
ryantanner / gist:7890912e286ec600936d
Created January 23, 2015 19:08
Go-to-line with ':' like vim in atom
'atom-text-editor.vim-mode:not(.insert-mode)':
':': 'go-to-line:toggle'
def receive = {
case DoWork =>
val data: Future[Data] = getHundredsOfMegabytesOfData()
data.flatMap(computationallyExpensiveOperations).pipeTo(sender())
}
@ryantanner
ryantanner / 20-cloudinit.conf
Last active August 29, 2015 14:07
etcd panic
core@ip-10-0-1-235 ~ $ cat /run/systemd/system/etcd.service.d/20-cloudinit.conf
[Service]
Environment="ETCD_ADDR=10.0.1.235:4001"
Environment="ETCD_CLUSTER_ACTIVE_SIZE=3"
Environment="ETCD_DISCOVERY=http://10.0.0.66:4001/v2/keys/_etcd/registry/cluster-dev-f9ekeksid832ik4k"
Environment="ETCD_NAME=10-0-1-235"
Environment="ETCD_PEER_ADDR=10.0.1.235:7001"
Environment="ETCD_TRACE=*"
Environment="ETCD_VERY_VERY_VERBOSE=true"
#!/usr/bin/env ruby
if `git diff --cached spec` =~ /,\s?(:focus|focus:\s?true|:focus\s?=>\s?true)/
puts "\e[31mPlease focus and remove your :focus tags before committing :)"
exit 1
end
@ryantanner
ryantanner / AnalyticsLeader.scala
Last active March 19, 2021 18:27
Conspire's implementation of work pulling
class AnalyticsLeader(supervisor: ActorRef) extends Leader[ProcessUser, AnalyticsNode, AnalyticsMessage](supervisor)