Skip to content

Instantly share code, notes, and snippets.

View ruxo's full-sized avatar

Ruxo ruxo

  • Bangkok
View GitHub Profile
@ruxo
ruxo / AkkaExtension.fs
Last active February 9, 2023 23:13
(temp) F# Akka extension
module RZ.FSharp.Akka.Extension
open System.Threading.Tasks
open Akka.Actor
open Akka.FSharp
open System.Runtime.CompilerServices
type ReceiveActorFs() =
inherit ReceiveActor()
@ruxo
ruxo / FsApi.Extensions.fs
Last active February 9, 2023 23:13
Akka.NET extension for F# with runAsync function
namespace Akka.FSharp.Extensions
open Akka.Dispatch
open System.Threading.Tasks
// source: https://github.com/tjaskula/akka.net-fsharp.extensions/blob/master/src/Akka.FSharp.Extensions/FsApi.Extensions.fs
module Actor =
open Akka.Actor
@latkin
latkin / NativeMethods.fs
Created February 22, 2016 19:46
F# p/invoke example with structs
namespace Test
open System.Runtime.InteropServices
// F# implementation of http://pinvoke.net/default.aspx/mpr.WNetAddConnection2
module NativeMethods =
type ResourceScope =
| Connected = 0x1u
| GlobalNet = 0x2u
@tparton42
tparton42 / Java8-JodaDateTime-To-TimeZonedDateTime.java
Last active January 28, 2020 20:01
Java 8: Convert JODA DateTime to Java Time.ZonedDateTime
private java.time.ZonedDateTime convertJODADateTimeToJavaZonedDateTime(DateTime originDateTime, DateTimeZone originTimeZone) {
if (originDateTime == null || originTimeZone == zone) {
return null;
}
// Convert from JODA to Java 8 time
java.time.ZonedDateTime newDateTime = java.time.ZonedDateTime.ofInstant(
Instant.ofEpochMilli(originDateTime.getMillis()), java.time.ZoneId.of(zone.getID()));
return newDateTime;
@un1t
un1t / parse-xml.go
Last active January 3, 2022 09:36
Golang XML stream parser
package main
// https://github.com/dps/go-xml-parse/blob/master/go-xml-parse.go
import (
"fmt"
"os"
"encoding/xml"
)
@sayurin
sayurin / isoimage.cs
Last active September 21, 2022 07:56
ISO image creator
using System;
using System.Runtime.InteropServices;
using IMAPI2FS; // COM reference: Microsoft IMAPI2 File System Image Creator
using IStream = System.Runtime.InteropServices.ComTypes.IStream;
class IsoImage {
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode, PreserveSig = true)]
static extern void SHCreateStreamOnFile(string pszFile, uint grfMode, out IStream ppstm);
static void Main(string[] args) {
F#C#ScalaClojurePythonRubyHaskellSQLOCamlCommon LispErlangSmalltalkSchemeEcmascript 5Perl 5
mapSelectmapmapmapcollectmapSelectmapmapcarmapcollect:mapmapmap
filterWherefilterfilterfilterselectfilterWherefilterremove-if-notfilterselect:filterfiltergrep
foldAggregatefoldLeftreducereduceinjectfoldl