Skip to content

Instantly share code, notes, and snippets.

View coderbyheart's full-sized avatar
🌩️
building serverless IoT solutions

Markus Tacker coderbyheart

🌩️
building serverless IoT solutions
View GitHub Profile
@coderbyheart
coderbyheart / README.md
Last active February 20, 2020 11:48
Dockerfile for a NCS application
@coderbyheart
coderbyheart / generate-sensor-messages.ts
Created November 1, 2019 13:34
Script to generate test data
import { Chance } from 'chance'
import { v4 } from 'uuid'
import { createWriteStream, WriteStream } from 'fs'
import * as path from 'path'
const numMessages = parseInt(process.argv[process.argv.length - 2], 10)
const outDir = process.argv[process.argv.length - 1]
const allSensors = [] as string[]
for (let i = 0; i < 5; i++) {
@coderbyheart
coderbyheart / gps.proto
Created August 19, 2019 10:55
protobuf example
package gps;
syntax = "proto3";
message gps {
message V {
double lng = 0;
double lat = 1;
double acc = 2;
double alt = 3;
double spd = 4;
@coderbyheart
coderbyheart / make-dummy-cert
Last active April 16, 2019 07:55
Elastic Beanstalk Nginx Configuration File
#!/bin/sh
umask 077
answers() {
echo --
echo SomeState
echo SomeCity
echo SomeOrganization
echo SomeOrganizationalUnit
echo localhost.localdomain
@coderbyheart
coderbyheart / SIMVendorRepository.ts
Last active March 7, 2019 11:55
functional repository
import { SIMVendor } from './SIMVendor';
export interface SIMVendorRepository {
findAll(): Promise<SIMVendor[]>;
/**
* @throws EntityNotFoundError if the SIMVendor cannot be found.
*/
getByUUID(uuid: string): Promise<SIMVendor>;
@coderbyheart
coderbyheart / How to provision a nRF9160 DK with custom cloud credentials.md
Created January 30, 2019 15:47
How to provision a nRF9160 DK with custom cloud credentials

How to provision a nRF9160 DK with custom cloud credentials using nRF Connect SDKs Asset Tracker sample.

In this example we want to provision the nRF9160 Development Kit with custom credentials to connect to an MQTT broker. For this guide we still want to connect it to nRF Connect for Cloud but as a new device.

Aquire a new certificate to connect to nRF Connect for Cloud

There is a section on connecting via MQTT to nRF Connect for Cloud in the handbook, but here are necessary steps in short:

Open the handbook and log in to with your nRF Connect for Cloud credentials. If you do not have an account, create a new one. (Note that you cannot use your DevZone account at the moment)

@coderbyheart
coderbyheart / lastframe.txt
Created December 19, 2018 00:00
"Mine Cart Madness" - Day 13 - Advent of Code 2018 https://adventofcode.com/2018/day/13 #AdventOfCode
/-------------------------------------\
/----------------------------------\ /---------------+-------------------------------------+--------\
/+----------------------------------+-------------------+---------------+----------------------------------\ | |
|| /---------+-------------------+-\ /-----------+--------------\ | | | /--------\
|| /------+--\ | /------+-+-+-----------+--------------+--------------\ | | | | |
|| | | | |/-----------+------+-+-+-----------+--------------+--------------+----+--+--\ | | |
|| /---------------+------+--+------++-----------+--\ | | | | /-------+----\ | | | | | | |
|| | /---+------+--+-\ || | | |
@coderbyheart
coderbyheart / classes.ts
Last active November 29, 2018 07:55
Classes vs Functions (TypeScript and Dependency Injection)
class FooManager {
private readonly barRepo: BarRepository
private readonly userPreferencesRepo: UserPreferencesRepository
constructor(barRepo: BarRepository, userPreferencesRepo: UserPreferencesRepository) {
this.barRepo = barRepo
this.userPreferencesRepo = userPreferencesRepo
}
async findMyFavoriteBar(user: User): Promise<Bar> {
const bars = await this.barRepo.findAll()
@coderbyheart
coderbyheart / clone-repos-with-filename.sh
Last active October 20, 2018 06:44
Batch clone repo containing certain filename
GITHUB_USERNAME=coderbyheart
ACCESS_TOKEN=`cat ~/.netrc | grep "github.com login $GITHUB_USERNAME" | awk '{ print $6; }'`
ORGANIZATION=nrfcloud
FILENAME=buildspec.yml
# Clone them all
curl -u $GITHUB_USERNAME:$ACCESS_TOKEN -s https://api.github.com/search/code\?q=org%3A${ORGANIZATION}+filename%3A$FILENAME | jq ".items[].repository.full_name" -a | xargs -I{} git clone https://github.com/{}