Skip to content

Instantly share code, notes, and snippets.

@axelson
axelson / gist:80eb528e6ef07c642c1f700f1f35eba0
Created July 30, 2019 22:01
nerves logs when ethernet works
00:00:06.247 [info] [ 3.424396] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
00:00:06.247 [info] [ 3.435738] hub 1-1.1:1.0: USB hub found
00:00:06.247 [info] [ 3.443079] hub 1-1.1:1.0: 3 ports detected
00:00:06.248 [warn] [ 3.803383] dwc_otg_handle_wakeup_detected_intr lxstate = 2
00:00:06.248 [info] [ 4.342360] usb 1-1.1.1: new high-speed USB device number 4 using dwc_otg
@axelson
axelson / gist:278400fec17dda89b979ea226f670db3
Created July 30, 2019 21:59
Nerves network log when ethernet is not working
00:00:06.632 [info] Start Network Interface Worker
00:00:06.653 [debug] Elixir.Nerves.Network setup(eth0)
00:00:06.685 [info] [ 6.668411] lan78xx 1-1.1.1:1.0 (unnamed net_device) (uninitialized): No External EEPROM. Setting MAC Speed
00:00:06.685 [info] [ 6.681917] libphy: lan78xx-mdiobus: probed
00:00:06.706 [info] nerves_network_interface received :ifadded and %{ifname: "eth0", index: 2}
@axelson
axelson / firmware_reload.ex
Created July 9, 2019 18:55 — forked from cblavier/firmware_reload.ex
Elixir nerves to upload firmware / reload code
defmodule Mix.Tasks.MyNervesProject.Firmware.Reload do
use Mix.Task
@app_name Mix.Project.config[:app]
@cookie_file "rel/vm.args"
@mdns_domain Application.get_env(:nerves_init_gadget, :mdns_domain)
@node_name Application.get_env(:nerves_init_gadget, :node_name)
def run(_) do
@axelson
axelson / base_calculator.ex
Last active May 7, 2019 03:53 — forked from sgyyz/base_calculator.ex
Elixir Abstract and Extends
defmodule BaseCalculator do
@moduledoc """
Define the base calculator and provide public API.
Define the callback to implement specific logic in child module.
"""
# it should be implemented by child module
@callback do_calculate(num1 :: integer, num2 :: integer) :: {:ok, integer} | {:error, any()}
def calculate(module, num1, num2) do
@axelson
axelson / resize.html
Created August 12, 2015 02:40
Example showing resize bug in firepad
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>CodeMirror: Autoresize Demo</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.2.0/codemirror.js"></script>
<script src="https://cdn.firebase.com/js/client/2.2.4/firebase.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.2.0/codemirror.css" />
@axelson
axelson / README.md
Last active August 29, 2015 14:25 — forked from mbostock/.block
Honolulu Buses Over Time

This simple bar chart shows the amount of buses operating in Oahu over time. As we can see the number of buses serving Oahu has not changed much since bus service was first introduced. While this is not a comprehensive analysis it would appear that the level of service for TheBus has gone down or at least not increased over time since area that TheBus serves has only increased. It would be nice to do an analysis that would include historical coverage areas and bus routes.

One way to increase bus service quality without an increase in funding is by increasing frequency on core routes, hopefully getting some routes to every 10

@axelson
axelson / README.md
Last active August 29, 2015 14:20 — forked from wpoely86/README.md

Diverging Stacked Bar Chart

We create a diverging stacked bar chart to plot a 5 point Likert scale. There a lots of ways to plot a Likert scale but according to Robbins & Heiberger, a diverging stacked bar chart is the best and I agree.

I've used D3.js. There is also an R package by Robbins & Heiberger.

The original can be found at github

@axelson
axelson / _.md
Created June 1, 2014 01:36
Nest Example
@axelson
axelson / _.md
Created June 1, 2014 00:20
Honolulu Budget Regular Pay (no scales)
@axelson
axelson / _.md
Created May 31, 2014 18:32
Honolulu Budget 3-int