Skip to content

Instantly share code, notes, and snippets.

View brase's full-sized avatar
🦄

Sebastian Brandt brase

🦄
  • SoftwareONE
  • Leipzig
  • 09:40 (UTC +02:00)
  • X @brase
View GitHub Profile
@ninjarobot
ninjarobot / ContainerApps-full-workflow.fsx
Last active December 19, 2021 19:23
Full workflow for Azure container apps with Farmer - build and push container, deploy to app.
#r "../../src/Farmer/bin/Debug/net5.0/Farmer.dll"
#r "nuget: FSharp.Text.Docker"
open System
open Farmer
open Farmer.ContainerApp
open Farmer.Builders
open FSharp.Text.Docker.Builders
// Create Container Registry
@kMutagene
kMutagene / dash-stock-ticker-less-loc.fs
Last active February 14, 2022 07:42
Dash stonks ticker App to pluck into an asp.netcore app via DashApp.toHttpHandler.
open Dash.NET; open Plotly.NET; open FSharp.Data; open Deedle; open System; open System.IO; open System.Text; open System.Text.RegularExpressions
let req = Http.Request("https://finance.yahoo.com/quote/AMZN/history?p=AMZN",httpMethod=HttpMethod.Get)
let body = match req.Body with | HttpResponseBody.Text b -> b
let crumb = Regex("CrumbStore\":{\"crumb\":\"(?<crumb>.+?)\"}").Match(body).Groups.["crumb"].Value
let cookie = req.Cookies.["B"]
let getDf ticker : Frame<System.DateTime,string> =
let response =
Http.RequestString(
@AmadorMunozBerzosa
AmadorMunozBerzosa / ActivePatterns.fs
Last active June 19, 2021 16:36
DSL wrapper for working with regular expressions in a readable manner in F#. Gist messes with the file ordering, but the correct file order is: Types > Evaluation > Operators > ActivePatterns > Examples
module Krow.Regex.ActivePatterns
open System.Text
let (|Regex|_|) (pattern:IRegex) input =
if input = null then
None
else
try
let match' = RegularExpressions.Regex.Match(input, pattern |> Regex.evaluate)
@nileshtrivedi
nileshtrivedi / home-server.md
Last active January 10, 2024 06:30
Home Server setup: Raspberry PI on Internet via reverse SSH tunnel

Raspberry Pi on Internet via reverse SSH tunnel

HackerNews discussed this with many alternative solutions: https://news.ycombinator.com/item?id=24893615

I already have my own domain name: mydomain.com. I wanted to be able to run some webapps on my Raspberry Pi 4B running perpetually at home in headless mode (just needs 5W power and wireless internet). I wanted to be able to access these apps from public Internet. Dynamic DNS wasn't an option because my ISP blocks all incoming traffic. ngrok would work but the free plan is too restrictive.

I bought a cheap 2GB RAM, 20GB disk VM + a 25GB volume on Hetzner for about 4 EUR/month. Hetzner gave me a static IP for it. I haven't purchased a floating IP yet.

@aheil
aheil / dist-upgrade.yml
Created November 9, 2019 22:21
Ansible task to upgrade Windows WSL 1.x Ubunto to latest release
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # #
# # Upgrade Windows WSL 1.x Ubunto to latest release # #
# # # #
# # Upgrade process based on: # #
# # https://medium.com/@rockey5520/wsl-ubuntu-upgrade-to-disco-dingo-19-04-b4abff20452d # #
# # # #
# # Created: 2019/11/01 23:54:53 # #
# # Last modified: # #
# # # #
@alfonsogarciacaro
alfonsogarciacaro / Deploy.md
Last active March 3, 2023 09:50
Deploying an F# ASP.NET Core app (Giraffe) to Azure

Deploying an F# ASP.NET Core app to Azure

Last week I spent a lot of time trying to deploy an F# ASP.NET Core app (a Giraffe app, specifically) to Azure because the information to complete all the steps was scattered in several places. So I'm writing this hopefully it will save the pain to others :)

Preparation

The following steps are mostly taken from this guide and it's only necessary to do them once:

  1. Create an account in Azure (or use an existing one)
  2. Create a resource group (or use an existing one)

Assert On Steroids

I find it useful to have assert statements in my code. It has several benefits:

  • Self documents code expectations
  • Establishes boundary checks between component
  • Helps to pinpoint problems by failing fast, especially when you just started dealing with a new library
  • Here is a good summary on using assertions.

In a dream world all this can be addressed by sophisticated type system but we all know it’s not going to happen any time soon.

@haf
haf / A vision for F#.md
Last active March 27, 2018 00:46
A vision for F#

What should F# as a language contain?

  • A default test framework like Expecto
  • A default HTTP client like HTTP.fs
  • A default web framework like Suave
  • A default JS framework like Fable
  • A default logging framework like Logary
  • A default character parser combinator library like FParsec
  • A default binary parser combinator library like FsAttoparsec
  • A default concurrent programming framework like Hopac
@latkin
latkin / regexinfo.ps1
Last active April 1, 2022 01:43
Regex matching helper
<#
Dumps capture group locations and names/numbers
Example:
> regexinfo 'Jenny: 555-867-5309' '(?<name>\w+):\s+(?<phone>(?:(?<area>\d{3})-)?(\d{3}-\d{4}))'
[Jenny]: [[555]-[867-5309]]
| || |
| || 1
| |area
| phone
@sgoguen
sgoguen / _about.md
Last active November 2, 2022 13:23
A Small Elm-like DSL in F#

Making Toys with F# - A Small Elm-like DSL in F#

A Small Elm-Like DSL in F#

I've been working on a talk about the virtues of building toy examples for the purpose of communicating ideas with simple interactive examples.

The toys I talk about in my presentation are based my interest in tools that allow programmers to quickly build web applications that allow them to explore their architecture. So to kickstart this series off, I want to introduce a simple