create a test-file
touch main_test.go
paste the code for a test:
package main
import (
| insert into artikler(article_type, content) | |
| values (1, '{"articleId": "xyz123", "meta":{"tag":"bil", "title":"ny elbil", "codes":["a","b"]}}'::jsonb); | |
| select content::text | |
| from artikler; | |
| select content -> 'meta' ->> 'title' as tittel | |
| from artikler | |
| where content -> 'meta' ->> 'tag' = 'bil'; |
create a test-file
touch main_test.go
paste the code for a test:
package main
import (
| import 'package:flutter/material.dart'; | |
| import 'package:syncfusion_flutter_charts/charts.dart'; | |
| void main() { | |
| runApp(const MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| const MyApp({super.key}); |
| #!/bin/bash | |
| STREAM_KEY=<insert your twitch stream key> | |
| ## you might want to use a different twitch-server, see https://stream.twitch.tv/ingests/ | |
| while true | |
| do | |
| libcamera-vid -o - --brightness 0.1 -t 0 -g 30 --width 640 --height 480 | ffmpeg -re -f h264 -i pipe:0 -vcodec copy -strict experimental -f flv rtmp://osl.contribute.live-video.net/app/$STREAM_KEY | |
| # pause a bit if things fail before restart | |
| sleep 60 | |
| done |
| package pgsql-helper | |
| import ( | |
| "database/sql" | |
| "fmt" | |
| ) | |
| //ExecReturningId executes query and returns id. | |
| // The query must specify what field is returned. | |
| // Example: |
| // validate org number according to https://www.brreg.no/om-oss/oppgavene-vare/alle-registrene-vare/om-enhetsregisteret/organisasjonsnummeret/ | |
| function validateNorwegianOrgNumber(rawNumber: string): boolean { | |
| if ( | |
| rawNumber == null || | |
| rawNumber.trim().length !== 9 || | |
| !/^\d*$/.test(rawNumber.trim()) | |
| ) | |
| return false; | |
| const numbers = rawNumber.trim(); | |
| const controlNumbers = [3, 2, 7, 6, 5, 4, 3, 2]; |
| import 'dart:math' as math; | |
| import 'package:flutter/material.dart'; | |
| @immutable | |
| class ExpandableFab extends StatefulWidget { | |
| const ExpandableFab({ | |
| Key? key, | |
| this.initialOpen, | |
| this.spacing = 70, |
| import 'package:http/http.dart'; // http library, http:0.13.0 | |
| import 'dart:developer'; // logging locally | |
| String? get baseUrl => "http://localhost:8081" | |
| Future<Response> postForm(String path, Map<String, String> body, {Map<String, String>? customHeaders}) async { | |
| final headers = commonHeaders() | |
| ..addAll(customHeaders ?? {}) | |
| ..addAll({"Content-Type": "application/x-www-form-urlencoded"}); | |
| log("POST $baseUrl$path with body $body and headers $headers", name: "http_service"); |
| # Web streaming example | |
| # Source code from the official PiCamera package | |
| # http://picamera.readthedocs.io/en/latest/recipes2.html#web-streaming | |
| import io | |
| import picamera | |
| import logging | |
| import socketserver | |
| from threading import Condition | |
| from http import server |