Skip to content

Instantly share code, notes, and snippets.

View Lokathor's full-sized avatar
🌴
Workin' on Rust Stuff

Lokathor Lokathor

🌴
Workin' on Rust Stuff
View GitHub Profile
@mbbx6spp
mbbx6spp / ExitCodeTestsExample.hs
Created November 6, 2011 20:30
Cabal file with test-suite block and explanation in a USAGE.md file.
module Main where
import Test.QuickCheck (quickCheck)
import Your.Module (encrypt, decrypt)
prop_reverseReverse :: [Char] -> Bool
prop_reverseReverse s = (reverse . reverse) s == s
prop_encryptDecrypt :: [Char] -> Bool
prop_encryptDecrypt s = (encrypt . decrypt) s == s
@qzchenwl
qzchenwl / OAuth2.hs
Created April 10, 2012 12:34
Simple oauth2.0 implementation in Haskell
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveDataTypeable #-}
import Data.Aeson
import qualified Data.ByteString.Char8 as BS
import qualified Data.ByteString.Lazy.Char8 as BSL
import Data.ByteString.Lazy (toChunks)
import Data.List
import Data.Maybe
import Data.Typeable (Typeable)
@tmspzz
tmspzz / install-haskell-stack-arm.sh
Last active April 28, 2019 07:00
A scrip to install Haskell Stack and set up things properly on Raspbian
#!/bin/sh
# Update: As of March 24th 2017 this script won't work.
# The script at https://get.haskellstack.org/ is broken
# because the binary of Stack 1.4 for ARM is missing from https://www.stackage.org/stack/ .
# You can still get the binary for Stack 1.3.2 from
# https://github.com/commercialhaskell/stack/releases/download/v1.3.2/stack-1.3.2-linux-arm.tar.gz
# and place it at $USR_LOCAL_BIN/stack in your system.
# Once Stack is installed you can proceed with the Install LLVM step
@harieamjari
harieamjari / aeabi.h
Last active September 8, 2023 11:17
aeabi.h declares the ARM run-time helper-function ABI for programs written in C.
/* aeabi.h - declares the ARM run-time helper-function ABI for programs written in C.
*
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
* In jurisdictions that recognize copyright laws, the author or authors
@zesterer
zesterer / nested_spans.rs
Created June 27, 2023 23:57
Chumsky's nested.rs example, but with spans included
use chumsky::{prelude::*, input::SpannedInput};
// This token is a tree: it contains within it a sub-tree of tokens
#[derive(PartialEq, Debug)]
enum Token {
Num(i64),
Add,
Mul,
Parens(Vec<(Token, SimpleSpan)>),
}
@wareya
wareya / text.glsl
Last active September 15, 2023 00:58
GLSL code for rendering numbers without using any textures or hardcoded arrays
// GLSL code for rendering numbers without using any textures or global arrays, using a tiny bitmap font
// for debugging!
// public domain. use under the creative commons zero license (any version)
// warning: the float-to-decimal conversion logic is "incorrect" and can only give around around four or five decimal places of floating point decision
const int _print_number_max_float_digits = 5;
const int _print_number_scale = 2;
const int _print_number_stretch_x = 1;
const int _print_number_stretch_y = 1;