Skip to content

Instantly share code, notes, and snippets.

View isovector's full-sized avatar

Sandy Maguire isovector

View GitHub Profile
@Lysxia
Lysxia / HTMLParser.hs
Last active September 5, 2022 14:07
Applicative HTML Parser
{-# LANGUAGE GADTs, DeriveFunctor, LambdaCase #-}
import Data.Functor.Product
import Data.Void
import Control.Applicative
type Tag = String
type Attr = String
data HTML
@TOTBWF
TOTBWF / Static.agda
Created December 1, 2021 07:50
Compile Time File Embedding in Agda
{-# OPTIONS --allow-exec #-}
-- Embed a file as a string inside of an agda program.
-- To use this, make sure to add '/bin/cat' to '~/.agda/executables'
module Static where
open import Function
open import Data.Unit
@TOTBWF
TOTBWF / ObfuscatedSKI.hs
Last active February 23, 2023 06:29
A Lambda Expression to SKI Combinator compiler, written entirely using SKI combinators.
This file has been truncated, but you can view the full file.
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE TemplateHaskell #-}
module ObfuscatedSKI where
import Unsafe.Coerce (unsafeCoerce)
--------------------------------------------------------------------------------
-- A Lambda to SKI Combinator Compiler, written entirely using SKI Combinators
--
@TOTBWF
TOTBWF / IOHCC.hs
Last active July 21, 2021 00:41
My submission for the International Obfuscated Haskell Code Competetion
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ImpredicativeTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module IOHCC where
import Unsafe.Coerce
u = unsafeCoerce
@gelisam
gelisam / GeneratingCode.agda
Created January 11, 2021 04:20
Who says Agda doesn't have tactics? 4-ish mechanisms for generating proofs in Agda
-- A demonstration of Agda's mechanisms for generating proofs:
-- * 1. fromMaybe
-- * 2a. macros
-- * 2b. type-aware macros
-- * 2c. stuck macros
--
-- Tested using Agda-2.6.1.1 and agda-stdlib-1.4
module GeneratingCode where
@IAmStoxe
IAmStoxe / loop-json.sh
Last active March 7, 2024 14:00
This example shows you how to utilize jq to loop bash script through an array of JSON values.
jsonData='[{"name": "name#1","value": "value#1"},{"name": "name#2","value": "value#2"}]'
for row in $(echo "${jsonData}" | jq -r '.[] | @base64'); do
_jq() {
echo "${row}" | base64 --decode | jq -r "${1}"
}
# OPTIONAL
# Set each property of the row to a variable
name=$(_jq '.name')
value=$(_jq '.value')
#!/bin/sh
set -e
# git snap: (re-)commit a snapshot of exactly another commit
# an alternative to 'pick' in git rebase -i: use x git snap <sha>
if [ -z "$1" ]; then
echo "usage: git snap <commit sha1>"
exit
fi
case `git cat-file -t $1` in
@adamgundry
adamgundry / GenericDiscrimination.hs
Created March 4, 2020 22:13
Being a horrible abuse of INCOHERENT to determine whether Generic instances exist
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
Tue Aug 27 19:56 2019 Time and Allocation Profiling Report (Final)
ghc.exe +RTS -p -RTS Main.hs --make -O -fforce-recomp
total time = 7.72 secs (7721 ticks @ 1000 us, 1 processor)
total alloc = 9,747,651,160 bytes (excludes profiling overheads)
COST CENTRE MODULE SRC %time %alloc
simplIdF Simplify compiler\simplCore\Simplify.hs:899:61-79 16.9 18.1
@unixfox
unixfox / README.md
Last active September 20, 2022 05:37
Block Cloudflare MITM attack

This is a source code of BCMA's "Block Cloudflare MITM Attack".

PRs are welcome.

This add-on will block, notify, or redirect your request if the target website is using Cloudflare.