Skip to content

Instantly share code, notes, and snippets.

@serefarikan
serefarikan / srtp_net6.fs
Created April 20, 2023 20:44 — forked from lukaszkrzywizna/srtp_net6.fs
SRTP F# .Net 6
type MyType =
| MyCase
static member statFun x = match x with MyCase -> "I'm static member function!"
static member statFunUnit () = "I'm static member function with unit param!"
static member statFunGeneric (x, y) =
match x with MyCase -> $"I'm static member function with generic param with value = %O{y}!"
static member statProp = "I'm static member property!"
member this.objProp = match this with MyCase -> "I'm object member property!"
member this.objFunGen x = match this with MyCase -> $"I'm object member function with param with value = %O{x}!"
member this.objFunUnit () = match this with MyCase -> "I'm object member function with unit param!"
Edit '/etc/sysconfig/jenkins' and add 'prefix=/jenkins' to 'JENKINS_ARGS'
**************************************************************************
JENKINS_ARGS="--prefix=/jenkins"
Comment out the default server config in '/etc/nginx/nginx.conf'
and create following file
'/etc/nginx/conf.d/domain.conf'
*************************************************
@serefarikan
serefarikan / MyModule.fs
Created January 24, 2022 09:15
A testing gist
//testing a gist
@serefarikan
serefarikan / how-to-install-graalvm-linux.md
Created March 11, 2021 18:04 — forked from ricardozanini/how-to-install-graalvm-linux.md
How to install GraalVM on Linux with alternatives

How to Install GraalVM Community Edition on Linux

Note: Tested on Fedora only

  1. Download the new release of GraalVM and unpack it anywhere in your filesystem:
$ tar -xvzf graalvm-ce-1.0.0-rc14-linux-amd64.tar.gz
@serefarikan
serefarikan / AttributeFactoryHelpers.java
Created January 29, 2021 11:03 — forked from TronPaul/AttributeFactoryHelpers.java
Substitutions needed to run Lucene 8.4.1 on a GraalVM native image
package org.apache.lucene.util;
import java.lang.reflect.Constructor;
import java.lang.reflect.UndeclaredThrowableException;
public final class AttributeFactoryHelpers {
static final AttributeFactory DEFAULT = new DefaultAttributeFactory();
static final Constructor<? extends AttributeImpl> findAttributeImplCtor(Class<? extends AttributeImpl> clazz) {
try {
let addChild updateNode addNode value parent =
match withNewChild value parent with
| None -> async.Return None
| Some (newParent, child) as path ->
async { do! addNode child
do! updateNode newParent
return Some child }
let addChildById getNode updateNode addNode logAction value parentId =
async { let! parent = getNode parentId
@serefarikan
serefarikan / wsl2-network.ps1
Created August 8, 2020 10:22 — forked from xmeng1/wsl2-network.ps1
WSL2 Port forwarding port to linux
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport = $matches[0];
} else{
echo "The Script Exited, the ip address of WSL 2 cannot be found";
exit;
}
module RResult =
open System.Collections.Generic
open System.Text
[<RequireQualifiedAccess>]
type RBad =
| Message of string
| Exception of exn
| Object of obj
| DescribedObject of string*obj
@serefarikan
serefarikan / RResult.md
Created July 25, 2020 15:59 — forked from mrange/RResult.md
Railway Oriented Programming and F# Result

Railway Oriented Programming and F# Result

Full source: https://gist.github.com/mrange/aa9e0898492b6d384dd839bc4a2f96a1

Option<_> is great for ROP (Railway Oriented Programming) but we get no info on what went wrong (the failure value is None which carries no info).

With the introduction F# 4.1 we got Result<_, _> a "smarter" Option<_> as it allows us to pass a failure value.

However, when one inspects the signature of Result.bind one sees a potential issue for ROP:

// <copyright file="CustomClaimsPrincipalFactory.cs" company="">
// Copyright (c)
// </copyright>
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using Platform.Business.Interfaces;
using Platform.Domain.Entities;