Skip to content

Instantly share code, notes, and snippets.

Project Setup

Team Name

  1. Decide on a team name.

  2. One member of the team should create the GitHub project space by following this https://classroom.github.com/a/vT9MQ3m_ When prompted, create a new team with the team name. Ensure that the team name format follows this structure: [Group Number(two digits)]-[Team Name]. For example: 05-demogods.

  3. Once the repository is created, other members can join the team via the same link https://classroom.github.com/a/vT9MQ3m_

  4. Everyone needs to clone the project to their computer.

  5. Don't waste time trying to get the project up and running just yet; focus on the SCRUM assignment first!

@bfritscher
bfritscher / main.dart
Created September 11, 2023 12:29
dart-streams
void main() async {
var stream = countStream(10);
print(stream);
stream.listen((value) {
print(value);
});
print("after stream");
stream = countStream(10);
await for (final value in stream) {
print(value);
@bfritscher
bfritscher / main.dart
Last active September 11, 2023 11:02
dart-future-async-await
void main() {
performTasks();
performTasksAsync();
}
void performTasks() {
String result = '';
Future<String> f;
result = task1();
print (result);
@bfritscher
bfritscher / mytheme.omp.json
Created August 15, 2023 15:11
Oh My Posh custom theme
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#003543",
"foreground": "#fff",
"powerline_symbol": "\ue0b0",
@bfritscher
bfritscher / group.py
Last active March 15, 2024 07:10
sort github classroom assignments into sub groups
import glob
import os
import csv
from collections import defaultdict
# Usage on windows
# gh classroom clone student-repos
# add classroom_roster.csv
# rename root folder and match prefix
assignment_prefix = 'vuejs-evaluation-ne-'
@bfritscher
bfritscher / odoo.py
Created November 24, 2022 20:07
odoo15 init mail composer with multiple attachments
template_id = 11 # lookup not working with env.ref('mail.template.Envoi dem. collocation, CV et CC (SRH)').id
compose_form_id = env.ref('mail.email_compose_message_wizard_form').id
attachment = {
'name': str(record.x_studio_cv_filename),
'datas': record.x_studio_cv,
'res_model': 'mail.compose.message',
'type': 'binary'
}
@bfritscher
bfritscher / sendToHA.js
Created September 14, 2022 13:08
node.js script to upload external data to home assistant via the websocket api
const W3CWebSocket = require("websocket").w3cwebsocket; // npm install websocket
const host = "127.0.0.1";
const port = 8123;
const protocol = "ws"; // ws or wss if ssl
// long lived access token from profile > Create Token
const access_token ="";
const entityName = "Energy Consumption";
const entityId = "energy_consumption_kwh";
@bfritscher
bfritscher / ultrasound.ino
Created August 25, 2022 03:09
esp8266 nodemcu hc-sr04 with web server and wifi AP
/*********
ESP8266 Server + HC-SR04 ultrasound
required libraries:
- https://github.com/me-no-dev/ESPAsyncTCP
- https://github.com/me-no-dev/ESPAsyncWebServer
Adapted from
Rui Santos
@bfritscher
bfritscher / userscripts.js
Last active August 17, 2022 17:03
cyberlearn fix
// ==UserScript==
// @name cyberlearn fix
// @namespace ig.he-arc.ch
// @match https://cyberlearn.hes-so.ch/*
// @grant none
// @version 1.0
// @author Boris Fritscher
// @description 8/16/2022, 10:49:56 AM
// ==/UserScript==
@bfritscher
bfritscher / index.php
Created November 30, 2020 09:03
roundshot image proxy
<?php
require('../myfeeds/core.php');
if (!isset($_GET['site']) or !isset($_GET['size'])) {
print("site: roundshot subdomain chaumont, neuchatel, lacdeneuchatel, jeunesrives, nyon-tourisme, morgesregion<br>morgesregion folder: ville<br>size: full, half, quarter, oneeighth, thumbnail");
die();
}
$site = $_GET['site'];
$size = $_GET['size'];
$folder = isset($_GET['folder']) ? $_GET['folder'] . '/' : '';
$json = json_decode(file_get_contents("https://$site.roundshot.co/{$folder}structure.json"));