Skip to content

Instantly share code, notes, and snippets.

@donthorp
donthorp / update-babashka.clj
Last active December 1, 2021 19:00
Script for updating Babashka on Pop OS (Ubuntu) using Babashka
#! /usr/bin/env bb
;; Simple script for updating babashka to latest
;;
;; Author: Don Thorp
;; Created: 1 Dec 2021
;;
;; Source: https://github.com/babashka/babashka#installation
;;
;; $ curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install
@donthorp
donthorp / hdmi-audio
Created November 3, 2021 22:43
Babashka script for telling Pop OS to select hdmi as the default sink
#! /usr/bin/env bb
(ns hdmi-audio
(:require
[clojure.java.shell :as shell :refer [sh]]
[clojure.string :as str]
)
)
(def restore-device-cmd "cat /etc/pulse/default.pa | grep \"load-module module-stream-restore restore_device=false\" > /dev/null")
@donthorp
donthorp / hdmi-audio
Created October 30, 2021 15:20
Move Audio to HDMI on Pop OS
#! /usr/bin/env bash
# pactl set-default-sink \$(pactl list short sinks | grep hdmi-stereo | cut -f 1)
cat /etc/pulse/default.pa | grep "load-module module-stream-restore restore_device=false" > /dev/null
if [ $? -ne 0 ]
then
echo
echo "You may need to edit /etc/pulse/default.pa and add change:"
Verifying that +donthorp is my blockchain ID. https://onename.com/donthorp
@donthorp
donthorp / gist:6040686
Created July 19, 2013 16:58
And that's how the fight started
My wife and I were watching Who Wants To Be A Millionaire while we were in bed.
I turned to her and said, 'Do you want to have Sex?'
'No,' she answered.
I then said, 'Is that your final answer?'
... She didn't even look at me this time, simply saying, 'Yes..'
So I said, "Then I'd like to phone a friend."
And that's when the fight started...
@donthorp
donthorp / channel.md
Last active December 15, 2015 04:29
Kandan Channel Notes

##Channels

  • A channel is a set of messages that is viewable and possibly broadcast to one or more subscribers.
  • A channel can be active, archived (frozen), or deleted.
  • An active channel has one or more subscribers and can be updated, searchable, subscribable, and viewable.
  • An archived channel is read-only, searchable, and viewable. (A daily log of an active channel could be archvied)
  • A channel may be public with open-subscriptions
  • A channel may be public and invite only
  • A channel may be private with open-subscriptions (if you know the name)
  • A channel may be private and invite only
@donthorp
donthorp / SimpleCursorLoader.java
Created June 22, 2012 20:42 — forked from casidiablo/SimpleCursorLoader.java
Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework SDK documentation for a class overview
/*
* Copyright 2012 CodeSlap - Cristian Castiblanco
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@donthorp
donthorp / gist:2957878
Created June 20, 2012 02:47
Z Axis Toner
const int contactPin = 7;
const int speakerPin = 6;
const int ledPin = 13;
int contactState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(contactPin, INPUT);
@donthorp
donthorp / update-vendor-branch.sh
Created June 14, 2012 19:47
Auto-track svn vendor branches in git
#! /bin/sh
# This script expects to be in the parent directory of your github projects
#
# in /etc/cron.hourly create a script that invokes this script for each repo
#
# sudo -u USER /home/USER/PROJECTS-ROOT/update-vendor-branch.sh PROJECT-DIR-1
# sudo -u USER /home/USER/PROJECTS-ROOT/update-vendor-branch.sh PROJECT-DIR-2
echo "Updating vendor repository: $1"
@donthorp
donthorp / ex01-buffer-create.js
Created April 28, 2011 19:01
Buffer Creation With Conversion
// Create a buffer and encode a string at the same time.
// Using default encoding of Ti.Codec.CHARSET_UTF8
var buffer = Ti.createBuffer({ value: "Hello World" });