Skip to content

Instantly share code, notes, and snippets.

Avatar

Daniel Barlow telent

View GitHub Profile
View gist:31b005fcf66606a97ec7f9046d8c229c
#include <Adafruit_NeoPixel.h>
#include <math.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 2
#define STRIP_LENGTH 150
Adafruit_NeoPixel strip = Adafruit_NeoPixel(STRIP_LENGTH, PIN, NEO_GRB + NEO_KHZ800);
@telent
telent / gist:9742059
Last active Oct 25, 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 gist:04b9724f81c993a7cc15
{stdenv
, fetchFromGitHub
, autoconf
, automake
, libtool
, c-ares
, popt
, openssl
, pkgconfig }:
View dan.nix
{ pkgs }:
let env = builtins.getEnv "TELENT_NIXPKGS";
telentNixpkgsSrc =
if env != ""
then
(builtins.trace "TELENT_NIXPKGS is set, build is impure" env)
else
fetchTarball { name = "telent-nixpkgs"; url="https://verisons.telent.net/private-git/telent-nixpkgs.git/snapshot/telent-nixpkgs-master.tar.gz"; };
in {
isNormalUser = true;
View cgit.nix
{ config, pkgs, ... }:
let projectroot = "/home/git/"; # where are the repos on the disk?
subdir = "private-git"; # url path prefix
staticFilesPath = "cgit-static"; # url path to cgit's static assets
# /home/git/published-by-cgit contains the list of projects
# that cgit will show
cgitrc = pkgs.writeText "cgitrc"
''
# default paths to static assets
css=/${staticFilesPath}/cgit.css
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";
You can’t perform that action at this time.