Skip to content

Instantly share code, notes, and snippets.

@ahle
ahle / dht-rpio.js
Created Jul 5, 2019
Read temperature and humidity with rpio
View dht-rpio.js
const rpio = require("rpio");
rpio.i2cBegin();
rpio.i2cSetSlaveAddress(0x04);
const writeBuffer = Buffer.from([40, 4, 1, 0]);
const readBuffer = Buffer.alloc(9, 0);
rpio.i2cWrite(writeBuffer);
rpio.i2cRead(readBuffer, readBuffer.length);
rpio.i2cEnd();
@ahle
ahle / dht-i2c-bus.js
Created Jul 5, 2019
Read temperature and humidity with i2c-bus
View dht-i2c-bus.js
const i2c = require('i2c-bus');
const i2c1 = i2c.openSync(1); # 1 because we're using the bus i2c-1
const writeBuffer = Buffer.from([40, 4, 1, 0])
const readBuffer = Buffer.alloc(9, 0);
i2c1.writeI2cBlockSync(4, 40, writeBuffer.length, writeBuffer);
i2c1.readI2cBlockSync(4, 1, readBuffer.length, readBuffer)
i2c1.closeSync()
View never.gif
![never](https://github.engineering.zhaw.ch/storage/user/2276/files/1f1c2780-5c62-11e9-85c9-07ae6857dcd8)
@ahle
ahle / appveyor.yml
Last active Mar 8, 2019
Installation of Azul Zulu 11 (OpenJDK) on Windows Server 2019 build image
View appveyor.yml
init:
- ps: Start-BitsTransfer -Source "https://cdn.azul.com/zulu/bin/zulu11.29.11-ca-jdk11.0.2-win_x64.msi" -Destination "C:\Users\appveyor\Downloads\zulu11.29.11-ca-jdk11.0.2-win_x64.msi"
- ps: Start-Process "msiexec" "/i `"C:\Users\appveyor\Downloads\zulu11.29.11-ca-jdk11.0.2-win_x64.msi`" /quiet /norestart" -Wait
- ps: $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
@stucksi1
stucksi1 / p01.c
Last active May 21, 2019
CTIT1 Praktikas
View p01.c
#include "utils_ctboard.h"
#include "reg_ctboard.h"
#define S0 0x60000200
#define LED0 0x60000100
#define ROTARY 0x60000211
#define DISPLAY 0x60000110
int main(void) {
/* initializations go here */
@neukoluc
neukoluc / gist:96d5cbcebdd32c563eeb6f8808b7f250
Created Feb 22, 2019
Protokoll PSIT3 Gruppe 2, Projektidee
View gist:96d5cbcebdd32c563eeb6f8808b7f250
Fabian Programmierung, Python, Basic Web, Desktop
Aaron Web
Peter Web, Bootstrap, PHP
Roberto Testing, Design, Web
Luca Java, Backend, Basic Web
Flavian Java, Basic Web, PL
Catan
Raumvermessung
Kreditkartenverwaltung
@berlimar
berlimar / matlab-cheatsheet.md
Last active Feb 19, 2019
Matlab Cheatsheet
View matlab-cheatsheet.md

Matlab Cheatsheet

doc Öffnet Dokumentation

doc <command> Öffnet Dokumentation zu command

Vektoren

Indizes beginnen bei 1

Zeilenvektor

a = [1 2 3]

View ms_sqlserver.md

Use MS_SQL_SERVER on MacOS with Docker

Download MS_SQL Docker Image

docker pull microsoft/mssql-server-linux:2017-latest

Create MS_SQL Docker Image

docker run -d --name ms_sqlserver -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=P@55w0rd' -e 'MSSQL_PID=Developer' -p 1433:1433 microsoft/mssql-server-linux:2017-latest

Start and Stop Docker Container

View TodoListRepository.java
public class TodoListRepository {
public Observable<List<Todo>> findTodosForToday(String userId) {
return findAllByUser(userId)
.flattenAsObservable(todoLists -> todoLists)
.flatMap(todoList -> findTodosForTodayByTodoList(todoList.getId()).toObservable());
}
public Single<List<Todo>> findTodosForTodayByTodoList(UUID listId) {
return Single.create(emitter -> this.firestore.collection(COLLECTION_TODO_LISTS)
.document(listId.toString())
You can’t perform that action at this time.