Skip to content

Instantly share code, notes, and snippets.

Avatar

Kristoffer Richardsson krichardsson

  • Bitcraze AB
  • Malmö Sweden
View GitHub Profile
@krichardsson
krichardsson / lpsTdoa3Tag.c
Last active May 25, 2021
TDoA3 Hybrid Mode, example implementation
View lpsTdoa3Tag.c
/*
* || ____ _ __
* +------+ / __ )(_) /_______________ _____ ___
* | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
* +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
* || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
*
* Crazyflie firmware.
*
* Copyright 2018-2021, Bitcraze AB
@krichardsson
krichardsson / gist:5d21dcb57715c8322ccdb4c191f7d75d
Created Oct 17, 2018
Prototype Position High Level Commander
View gist:5d21dcb57715c8322ccdb4c191f7d75d
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2018 Bitcraze AB
#
@krichardsson
krichardsson / pomodoro.coffee
Last active Nov 24, 2016
Dashing pomodoro widget
View pomodoro.coffee
class Dashing.Pomodoro extends Dashing.Widget
ready: ->
setInterval(@startCountdown, 500)
startCountdown: =>
current_timestamp = Math.round(new Date().getTime()/1000)
end = parseInt($(@node).find("#pomodoro-end-time").html())
end_timestamp = Math.round(end / 1000)
seconds_until_end = end_timestamp - current_timestamp
@krichardsson
krichardsson / Readme.md
Created Nov 23, 2015
Dashing octoprint integration
View Readme.md

Simple octoprint integration for dashing

The status and remaining time is pulled in from octoprint by the client. An image is taken from a webcam and added as background for the widget.

Add to your dashboard

<li data-sizex="1" data-sizey="1">
  <div data-id="octoprint" data-view="Octoprint" data-title="3D printer"></div>
</li>
@krichardsson
krichardsson / gist:41e125a267624d589613
Last active Sep 25, 2015
Populate mysql docker container from sql file
View gist:41e125a267624d589613
# Create a mysql container
docker run --name myDb -e MYSQL_DATABASE=db-name -e MYSQL_ROOT_PASSWORD=topsecret -p 3306:3306 -d mysql
# Populate it
docker run --rm -it --link myDb:mysql -v ${PWD}:/dump mysql sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD" --database="$MYSQL_ENV_MYSQL_DATABASE" < /dump/my-dump.sql'
View gist:4311eac592a3569fa08a
boot2docker ssh sudo /etc/init.d/docker restart
View gist:f35d954cdd114833331d
One way to enable a docker container to use docker, is to pass the socket for the docker daemon to the container. To make it work you need to:
1. use a container that has the docker cli installed. A dockerfile for that
FROM debian
RUN apt-get update && apt-get install wget -y
RUN wget https://get.docker.io/builds/Linux/x86_64/docker-latest -O /bin/docker
RUN chmod +x /bin/docker
2. mount the docker daemon socket when the container is started docker
@krichardsson
krichardsson / number.coffee
Last active Aug 29, 2015
Dashing number widget that changes color based on the direction of the arrow
View number.coffee
class Dashing.Number extends Dashing.Widget
@accessor 'current', Dashing.AnimatedValue
@accessor 'difference', ->
if @get('last')
last = parseFloat(@get('last'))
current = parseFloat(@get('current'))
if last != 0
diff = Math.abs(Math.round((current - last) / last * 100))
"#{diff}%"
View keybase.md

Keybase proof

I hereby claim:

  • I am krichardsson on github.
  • I am krichardsson (https://keybase.io/krichardsson) on keybase.
  • I have a public key whose fingerprint is 4535 9909 0180 64B7 1D84 B93D A9C9 475D B071 7717

To claim this, I am signing this object: