Skip to content

Instantly share code, notes, and snippets.

View adelarsq's full-sized avatar
🐢
I may be really slow to respond.

Adelar da Silva Queiróz adelarsq

🐢
I may be really slow to respond.
View GitHub Profile
@JustinGrote
JustinGrote / AddFSharpType.fs
Created October 24, 2021 23:52
A version of Add-Type for F# in PowerShell
namespace AddFSharpType
module AddFSharpType =
open System.IO
open FSharp.Compiler.CodeAnalysis
open System
/// This is basically the compiler so we name it that way
let compiler = FSharpChecker.Create()
let AddFromFile (sourceFile : string) =
@p4bl0-
p4bl0- / 00_readme.md
Last active October 12, 2023 09:09
A complete compiler for a simple language (in less than 150 LoC)

This project is a tiny compiler for a very simple language consisting of boolean expression.

The language has two constants: 1 for true and 0 for false, and 4 logic gates: ! (not), & (and), | (or), and ^ (xor).

It can also use parentheses to manage priorities.

Here is its grammar in BNF format:

expr ::= "0" | "1"

@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(
@object
object / ProtobufSerializationTest.fs
Created May 24, 2021 19:13
Protobuf serialization in F#
module ProtobufSerializationTests
open System
open System.IO
open ProtoBuf
open Xunit
module ProtoBufUtils =
[<ProtoContract>]
@ityonemo
ityonemo / test.md
Last active May 8, 2024 20:17
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

@saneleg24
saneleg24 / PY0101EN-2-4-Dictionaries.ipynb
Created October 5, 2020 01:06
Created on Skills Network Labs
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@PatOConnor43
PatOConnor43 / lsp_config.lua
Created September 24, 2020 15:24
A small gist to show a dartls setup function to allow all the codeactions. These can be shown with `:lua vim.lsp.buf.code_action()`
local dart_capabilities = vim.lsp.protocol.make_client_capabilities()
dart_capabilities.textDocument.codeAction = {
dynamicRegistration = false;
codeActionLiteralSupport = {
codeActionKind = {
valueSet = {
"",
"quickfix",
"refactor",
"refactor.extract",
@bent-rasmussen
bent-rasmussen / Actor.fs
Last active September 12, 2023 04:23
Experimental high performance actor implementation for F# using channel and task computation expression.
// NOTE: import this Nuget package: TaskBuilder.fs (written using 2.1.0)
//
// Tested in LINQPad (hence Dump method usage).
open System
open System.Collections
open System.Collections.Generic
open System.Diagnostics
open System.Linq
open System.Threading
@vindarel
vindarel / Common Lisp VS Racket - testimonies.md
Last active April 20, 2024 03:18
Common Lisp VS Racket. Feedback from (common) lispers.

Developer experience, libraries, performance… (2021/11)

I'll preface this with three things. 1. I prefer schemes over Common Lisps, and I prefer Racket of the Schemes. 2. There is more to it than the points I raise here. 3. I assume you have no previous experience with Lisp, and don't have a preference for Schemes over Common Lisp. With all that out of the way... I would say Common Lisp/SBCL. Let me explain

  1. SBCL Is by far the most common of the CL implementations in 2021. It will be the easiest to find help for, easiest to find videos about, and many major open source CL projects are written using SBCL
  2. Download a binary directly from the website http://www.sbcl.org/platform-table.html (even for M1 macs) to get up and running (easy to get started)
  3. Great video for setting up Emacs + Slime + Quick Lisp https://www.youtube.com/watch?v=VnWVu8VVDbI

Now as to why Common Lisp over Scheme

// This sample will guide you through elements of the F# language.
//
// *******************************************************************************************************
// To execute the code in F# Interactive, highlight a section of code and press Alt-Enter in Windows or
// Ctrl-Enter Mac, or right-click and select "Send Selection to F# Interactive".
// You can open the F# Interactive Window from the "View" menu.
// *******************************************************************************************************
//
// For more about F#, see:
// http://fsharp.org