Skip to content

Instantly share code, notes, and snippets.

var long lastNotified = 0
var String lastReceipt
rule "Alert for bad air"
when
Item Master_Air_Pm25 changed or System started
then
val pm25 = (Master_Air_Pm25.state as Number).intValue
logDebug("air-quality", "pm25 = {}", pm25)
if ((now.millis - lastNotified) > 3600000) {
if (pm25 >= 15) {
#define _DEBUG
unsigned int pm1 = 0;
unsigned int pm2_5 = 0;
unsigned int pm10 = 0;
long lastPmReading = 0;
byte buffer[24];
void setup() {
@timcharper
timcharper / crash-log.txt
Created June 15, 2018 17:59
Emacs 26.1 stale server file server-start crash
Process: Emacs-x86_64-10_10 [54595]
Path: /Applications/Emacs.app/Contents/MacOS/Emacs-x86_64-10_10
Identifier: org.gnu.Emacs
Version: Version 26.1 (9.0)
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Emacs-x86_64-10_10 [54595]
User ID: 501
Date/Time: 2018-06-15 11:11:33.871 -0600
@timcharper
timcharper / README.md
Last active May 21, 2018 22:38
reset audio.ahk

Parallels desktop audio record latency will increase, slowly, over time. This is been an issue that I have encountered over many years of using the software. I'm not sure if it is related to clock drift, or what.

A relatively easy "fix" is to disable the microphone in the audio control panel, and then reenable it. Unfortunately, if you do this while Dragon is listening, it will cause Dragon to freeze up in a pretty bad way, so you must do the following:

  1. Turn off the microphone in Dragon
  2. Disable the microphone in the audio control panel recording pane
  3. Reenable the microphone in the audio control panel recording pane
  4. Turn the microphone on in Dragon again

In my configuration, I have the key ctrl-` bound to turn on/turnoff the microphone in Dragon. Also, in the audio control panel recording pane, I only have one device, so the offsets in this auto hot key script work. You may need to tweak it, for your own use. Hopefully, it gives you a starting point.

@timcharper
timcharper / output.json
Created March 20, 2018 03:30
OrientDB simple delete benchmark
{"op": "removing each vertex one at a time", "secs": 5.85228219}
{"op": "method 1", "secs": 5.87633618}
{"op": "removing edges first", "secs": 31.594552465}
{"op": "removing each vertex one at a time", "secs": 0.48545163}
{"op": "method 2", "secs": 32.106060129}
{"op": "remove edges via sql", "secs": 2.645357744}
{"op": "remove vertices via direct delete sql", "secs": 6.376951457}
{"op": "method 3", "secs": 9.050751531}

Keybase proof

I hereby claim:

  • I am timcharper on github.
  • I am timcharper (https://keybase.io/timcharper) on keybase.
  • I have a public key ASA55PBWERBlKtFZOOxM-PPqyojWNz0ttZGh7X7FP4E8Gwo

To claim this, I am signing this object:

@timcharper
timcharper / akka_streams_pitfalls_1.sc
Last active December 5, 2017 19:18 — forked from aludwiko/akka_streams_pitfalls_1.scala
Download this and run with ammonite
#!/usr/bin/env amm
import $ivy.`com.typesafe.akka::akka-stream:2.5.4`
import akka.Done
import akka.stream._
import akka.stream.scaladsl._
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
10:33 $ grep "rate limited" consoleTest10
ERROR[08:57:10 DockerAppIntegrationTest-MesosMaster-32774] ProcessLogger DockerAppIntegrationTest-MesosMaster-32774 was rate limited; 51 lines were supressed
ERROR[08:57:11 ReadinessCheckIntegrationTest-MesosMaster-32785] ProcessLogger ReadinessCheckIntegrationTest-MesosMaster-32785 was rate limited; 66 lines were supressed
ERROR[08:57:11 GroupDeployIntegrationTest-MesosMaster-32784] ProcessLogger GroupDeployIntegrationTest-MesosMaster-32784 was rate limited; 66 lines were supressed
ERROR[08:57:11 MarathonStartupIntegrationTest-MesosMaster-32778] ProcessLogger MarathonStartupIntegrationTest-MesosMaster-32778 was rate limited; 66 lines were supressed
ERROR[08:57:12 LaunchQueueIntegrationTest-MesosMaster-32793] ProcessLogger LaunchQueueIntegrationTest-MesosMaster-32793 was rate limited; 57 lines were supressed
ERROR[08:57:17 ZooKeeperTest-MesosMaster-32805] ProcessLogger ZooKeeperTest-MesosMaster-32805 was rate limited; 56 lines were supressed
ERROR[08:57:48 AppDeployI
@timcharper
timcharper / rpmbuild
Last active March 14, 2018 19:39
Docker powered rpm-build (HACK that works for sbt-native-packager); put in your path and chmod +x
#!/bin/bash
# silly little workaround to make rpmbuild work through docker
# Build the image if it doesn't already exist
if !(docker inspect rpm-build 2>/dev/null 1>/dev/null); then
echo "rpm-build image does not exist; building"
rm -rf /tmp/rpm-build
mkdir -p /tmp/rpm-build
cat <<-EOF > /tmp/rpm-build/Dockerfile
@timcharper
timcharper / download-checked.sh
Created August 5, 2017 01:49
Download file checking sha256sum
#/bin/bash
URL="$1"
DEST="$2"
SHA256SUM=$3
curl -L -f -o "${2}.tmp" "$1"
do_sha256sum() {
cmd=$(which sha256sum shasum | head -n 1)
case $(basename "$cmd") in