Skip to content

Instantly share code, notes, and snippets.

package io.github.nomisrev
import app.cash.sqldelight.driver.jdbc.asJdbcDriver
import arrow.continuations.SuspendApp
import arrow.continuations.ktor.server
import arrow.fx.coroutines.autoCloseable
import arrow.fx.coroutines.closeable
import arrow.fx.coroutines.resourceScope
import com.zaxxer.hikari.HikariConfig
import com.zaxxer.hikari.HikariDataSource
open Donald
open System.Data.Common
open System.Data.SQLite
open System.Threading.Tasks
open Giraffe
open Giraffe.ViewEngine
open FsToolkit.ErrorHandling
open Microsoft.AspNetCore.Builder
[<RequireQualifiedAccess>]
@giuliohome
giuliohome / io.fsx
Created June 6, 2017 15:15 — forked from battermann/io.fsx
IO Monad in F#
[<AutoOpen>]
module IO =
type IO<'a> =
private
| Return of (unit -> 'a)
| Suspend of (unit -> IO<'a>)
let rec run x =
match x with
| Return v -> v()
@giuliohome
giuliohome / my_video_capture.html
Created March 14, 2023 16:27
video capture, html5
<!DOCTYPE html>
<html>
<body>
<h1>Recording Video from the User</h1>
<p>Acquire access to the camera</p>
<video id="player" controls></video>
<a id="download">Download</a>
@giuliohome
giuliohome / flask-sqlserver-googlekubernetesengine.build-trigger-inline.yaml
Created February 16, 2022 08:49
Google Cloud Run - build trigger - inline yaml
steps:
- name: gcr.io/cloud-builders/docker
args:
- build
- '--no-cache'
- '-t'
- '$_GCR_HOSTNAME/$PROJECT_ID/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA'
- .
- '-f'
- Dockerfile
@giuliohome
giuliohome / Makefile
Last active September 13, 2021 22:00
IMGUI + GLFW
# Cross Platform Makefile
# Compatible with MSYS2/MINGW, Ubuntu 14.04.1 and Mac OS X
#
# You will need GLFW (http://www.glfw.org):
# Linux:
# apt-get install libglfw-dev
# Mac OS X:
# brew install glfw
# MSYS2:
# pacman -S --noconfirm --needed mingw-w64-x86_64-toolchain mingw-w64-x86_64-glfw
@giuliohome
giuliohome / BindableTextBlock.cs
Last active December 18, 2020 08:27
TextBloacks with colours !!!
public class BindableTextBlock : TextBlock
{
public ObservableCollection<Inline> InlineList
{
get { return (ObservableCollection<Inline>)GetValue(InlineListProperty); }
set { SetValue(InlineListProperty, value); }
}
public static readonly DependencyProperty InlineListProperty =
DependencyProperty.Register("InlineList", typeof(ObservableCollection<Inline>), typeof(BindableTextBlock), new UIPropertyMetadata(null, OnPropertyChanged));
@giuliohome
giuliohome / 2serv.py
Last active June 1, 2020 18:11 — forked from phrawzty/2serv.py
simple python http server to dump request headers
#!/usr/bin/env python2
import SimpleHTTPServer
import SocketServer
import logging
PORT = 8000
class GetHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
open System
open System.IO
open System.Diagnostics
// my first part was 3247
//Found min cross at steps 48054 X 4537 and Y 4955
//done in (101) ms !
type Point = {X:int; Y:int; Steps: int} with
override this.ToString() = sprintf "(%d,%d,%d)" this.X this.Y this.Steps
open System
open System.IO
let readInts (path:string) : int [] =
use sw = new StreamReader (path)
sw.ReadToEnd().Split(",")
|> Array.map Int32.Parse
type Status = {memory:int[]; position: int; finished: bool;}
type Cmd = {opcode: int; op1:int ; op2: int; dest:int}