Skip to content

Instantly share code, notes, and snippets.

View fhunleth's full-sized avatar
👋

Frank Hunleth fhunleth

👋
View GitHub Profile
@fhunleth
fhunleth / barometer.ex
Created July 17, 2019 14:15
BMP280 sample
defmodule Barometer do
alias ElixirALE.I2C
@sealevel_pa 101325
@doc """
Put the BMP280 in normal mode and sample the temperature and
pressure sensor at ultra high resolution.
"""
def enable() do
@fhunleth
fhunleth / fwup_to_slack.sh
Created April 26, 2019 13:15
fwup metadata to slack
./jq-linux64 -n \
--arg meta_uuid $(grep 'meta-uuid' <<< $FW_META | awk -F"=" '{ print $2}') \
--arg meta_version "$(grep 'meta-version' <<< $FW_META | awk -F"=" '{ print $2}')" \
--arg meta_vcs_identifier "$(grep 'meta-vcs-identifier' <<< $FW_META | awk -F"=" '{ print $2}')" \
--arg meta_platform "$(grep 'meta-platform' <<< $FW_META | awk -F"=" '{ print $2}')" \
--arg meta_creation_date "$(grep 'meta-creation-date' <<< $FW_META | awk -F"=" '{ print $2}')" \
--arg meta_misc "$(grep 'meta-misc' <<< $FW_META | awk -F"=" '{ print $2}')" \
'{channel: "C41SHHGQ5", as_user: true, blocks: [
{type: "section", block_id: "text1", text: {type: "mrkdwn", text: "*A new FarmBot Firmware is available*"}},
{type: "context", elements: [
@fhunleth
fhunleth / cookbook.md
Created February 16, 2019 18:06
NervesHub Cookbook

Publish and deploy the currently built firmware

mix nerves_hub.firmware publish --key fwsigner1 mix nerves_hub.deployment update qa firmware

@fhunleth
fhunleth / strace.md
Created December 19, 2018 17:22
strace cheatsheet

Only trace calls to exec

strace -s 1024 -e abbrev=none -qfeexecve <program and args>
#include <stdio.h>
#include <math.h>
/*
Experiment with the lgamma function. This function makes it possible to approximate
factorials of very large numbers and runs incredibly fast.
See https://github.com/bminor/musl/blob/master/src/math/lgamma_r.c for how lgamma is
calculated.
#!/bin/sh
#
# Upload new firmware to a target running nerves_firmware_ssh
#
# Usage:
# upload.sh [destination IP] [Path to .fw file]
#
# If unspecifed, the destination is nerves.local and the .fw file
# is naively guessed
@fhunleth
fhunleth / nerves-todo.md
Last active June 24, 2016 09:03
Master nerves project TODO list

nerves project management

  1. Find sponsorship or grants
  2. Find more collaborators

nerves website

  1. docs
  2. tutorials
  3. pretty picture pass to make site look more professional