Skip to content

Instantly share code, notes, and snippets.

Daniel Barlow telent

View GitHub Profile
@telent
telent / gist:9742059
Last active May 29, 2020
12 factor app configuration vs leaking environment variables
View gist:9742059
App configuration in environment variables: for and against
For (some of these as per the 12 factor principles)
1) they are are easy to change between deploys without changing any code
2) unlike config files, there is little chance of them being checked
into the code repo accidentally
3) unlike custom config files, or other config mechanisms such as Java
View configure-firefox.py
#!/usr/bin/env nix-shell
#! nix-shell -i python -p python3
prefs = """
pref("toolkit.policies.perUserDir", true);
pref("ui.key.accelKey", 18);\n', # use Alt instead of Ctrl
"""
policies = {
"policies": {
@telent
telent / polar.rb
Created Apr 26, 2012
Interface with a polar bluetooth hrm from ruby (linux)
View polar.rb
require 'pp'
require 'socket'
module BluetoothPolarHrm
AF_BLUETOOTH=31 # these are correct for the Linux Bluez stack
BTPROTO_RFCOMM=3
class << self
def connect_bt address_str,channel=1
bytes=address_str.split(/:/).map {|x| x.to_i(16) }
s=Socket.new(AF_BLUETOOTH, :STREAM, BTPROTO_RFCOMM)
@telent
telent / iso.nix
Created Nov 29, 2019
nix livecd with "blocks" support for in-place bcache addition
View iso.nix
{config, pkgs, lib, ...}:
let
maintboot = pkgs.python3Packages.buildPythonPackage rec {
pname = "maintboot";
version = "1";
src = pkgs.fetchFromGitHub {
owner = "g2p";
repo = "maintboot";
rev = "1c5ab872bae2b69a06252ca2e7ecdba4d4ad8e57";
sha256 = "0n8sy6ksqb5s1n5qqshb6pz1d86gjshwb30mr1nil0hfln5gi4g2";
View boot_build.clj
;; this is src/myproject/boot_build.clj
(ns myproject.boot-build
(:require [boot.core :as core]
[cemerick.pomegranate.aether :as aether]
[boot.util :as util]
[boot.pod :as pod]
[clojure.java.io :as io]
[clojure.string :as str]
[cheshire.core :as json]
@telent
telent / default.nix
Created Nov 28, 2018
arcan build with nixos
View default.nix
with import <nixpkgs> {};
stdenv.mkDerivation rec {
name = "arcan";
version="1";
src = ./.;
nativeBuildInputs = with pkgs; [
cmake git
] ;
CMAKE_CXX_FLAGS = "-msse4.1";
DRM_INCLUDE_DIR = "${pkgs.libdrm.dev}/include/libdrm";
@telent
telent / sagepay-admin.rb
Created Nov 4, 2010
Talking to Sagepay Reporting & Admin API from Ruby
View sagepay-admin.rb
require 'patron'
require 'time'
require 'active_support/core_ext/hash.rb'
require 'digest/md5'
require 'nokogiri'
module SagePay;end
class SagePay::Admin
def initialize(args)
View ralink-dtb.patch
View ilo.ino
#define RELAY_PIN (8)
void setup() {
// put your setup code here, to run once:
SERIAL_PORT_USBVIRTUAL.begin(115200); // open serial connection via USB-Serial
pinMode(RELAY_PIN, OUTPUT);
pinMode(LED_BUILTIN, OUTPUT);
}
@telent
telent / abstract.md
Last active Jun 14, 2018
Nixcon2018 talk proposal
View abstract.md

Title

NixWRT: purely functional firmware images for IoT devices

Abstract

Reflashing your broadband router with Linux (DD-WRT or OpenWRT or Tomato or variants) gives you unparalleled flexibility to do things that the manufacturer probably hadn't thought of. Remembering what you did, six months later, is often trickier.

You can’t perform that action at this time.