Skip to content

Instantly share code, notes, and snippets.

View iwillspeak's full-sized avatar
🚲
The status is always bike

Will Speak iwillspeak

🚲
The status is always bike
View GitHub Profile
@iwillspeak
iwillspeak / LLVM From Rust.md
Last active July 30, 2023 08:40
Example of using LLVM from Rust

An Example of Using LLVM from Rust

This example compiles a simple function using the LLVM C API through the llvm-sys crate.

type Kind =
| Number
| Literal
| Binary
let chooseLeft = function
| Choice1Of2 x -> Some x
| _ -> None
let chooseRight = function
<Project Sdk="Feersum.Sdk/0.2.1">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="hello.scm" />
</ItemGroup>
@iwillspeak
iwillspeak / .gitignore
Last active August 19, 2021 07:39
Example Cake Script for Tyrannoport
bin/
obj/
TestReports/
tools/
/.config/
@iwillspeak
iwillspeak / env_export.sh
Last active August 6, 2021 10:43
Shows how to export .env data to the current environment
#! /usr/bin/env bash
# this sub-shell constrains the scope of the injected variables
(
export $(xargs <<EOF
Foo=hello
Bar=world
EOF
)
@iwillspeak
iwillspeak / .gitignore
Last active December 11, 2020 11:50
A Microcrate containing an example hand-written lexer.
target
@iwillspeak
iwillspeak / eratosthenes.scm
Created September 4, 2020 20:53
Sieve of Eratosthenes in Scheme
;; Implementation of the Sieve of Eratosthenes
;; https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
(define (eratosthenes n)
;; Mark multiples of the given prime in the vector
(define (mark-multiples p marked)
(define (mark-multiples-at p m marked)
(if (>= m (vector-length marked))
marked
(begin
(vector-set! marked m #t)
@iwillspeak
iwillspeak / Class1.cs
Last active August 20, 2020 07:58
.NET NU5104 NoWarn Build Errors
using System;
namespace bugz
{
public class Class1
{
// This package used to be packable with the .NET Core 3.1.301 SDK but
// packaging fails with the .NET Core 3.1.401 SDK. The exit code from
// `dotnet pack` is now 1 indicating failure. This has prevented
// release builds of some of our libraries.
@iwillspeak
iwillspeak / Cargo.toml
Created September 3, 2016 17:49
Simple Pratt-style Parsing in Rust
[package]
name = "parsetest"
version = "0.1.0"
authors = ["Will Speak <lithiumflame@gmail.com>"]
[dependencies]
[[bin]]
name = "parsetest"
path = "main.rs"
@iwillspeak
iwillspeak / Counter.elm
Created May 2, 2018 08:22
Simple Elm Counter
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
main = Html.beginnerProgram { model = model, view = view, update = update }
--- MODEL
type alias Model = Int