Skip to content

Instantly share code, notes, and snippets.

View matthinc's full-sized avatar
🧑‍🎓
Studying

Matthias Rupp matthinc

🧑‍🎓
Studying
View GitHub Profile
import Data.Complex (magnitude, Complex ((:+)))
main :: IO ()
main = putStrLn $ foldl (\a r -> a ++ r ++ "\n") "" (row <$> [-1,-0.9..1])
where row r = concat $ (\c -> mandelbrot (c :+ r )) <$> [-2,-1.95..1]
mandelbrot c = if (magnitude $ iterations c) > 2 then " " else "*"
iterations c = (iterate (\z -> z^2 + c) (0.0 :+ 0.0)) !! 10
$ runghc mandelbrot.hs
name: Pipeline
env:
CI: true
on: push
jobs:
BUILD_DEBUG:
name: Build debug apk
@matthinc
matthinc / borg.sh
Last active April 4, 2023 14:06
Script for using borg-backup with Hetzner storagebox
#!/usr/bin/env bash
########## Configuration ##########
SSH_PASSWD="" # SSH password of the storagebox
BORG_USER="" # Storagebox user
BORG_SERVER="xxx.your-storagebox.de" # Storagebox
BORG_REPO="~/borg" # Borg repository on the storagebox
FILES="/home /opt" # Files to backup (space separated)
###################################
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <MQTT.h>
#include <stdint.h>
// Configuration
#define WIFI_SSID ""
#define WIFI_PASSWORD ""
#define MQTT_BROKER "192.168.1.70"
// Heizplan
const heatingPlan = [20, 21, 22, 23, 23.5, 25, 25, 25, 25, 20];
const currentPosition = context.get('pos') || 0;
// Berechne und speichere nächste Position
const nextPosition = (currentPosition++) % heatingPlan.length;
context.set('pos', nextPosition);
// Zieltemperatur

Keybase proof

I hereby claim:

  • I am matthinc on github.
  • I am matthinc (https://keybase.io/matthinc) on keybase.
  • I have a public key whose fingerprint is 061F 14F2 ECA6 405F 1A89 509A 9E78 ADD3 777C 67A2

To claim this, I am signing this object:

#include<stdio.h>
#include<stdint.h>
#include<stdlib.h>
#include <stdbool.h>
#include <sys/stat.h>
// Constants
const uint32_t MAX_READ_WRITE_BLOCK_SIZE = 256;
const uint32_t MAX_FILENAME_SIZE = 64;
fourier_function = @(x, k) (2./(pi .^2)) * (1./(k.^2)) * (((-1).^k)-1);
test_range = 0:0.1:10;
k_range = 1:10;
fourier_values = zeros(size(test_range));
for k = k_range
values = fourier_function(test_range, k) .* e.^(i * k * test_range);
fourier_values = fourier_values + values;
end