Skip to content

Instantly share code, notes, and snippets.

View puffnfresh's full-sized avatar

Brian McKenna puffnfresh

View GitHub Profile
@sevanspowell
sevanspowell / EmacsTooling.md
Last active July 6, 2022 01:11
A guide to setting up the Haskell tooling for Emacs in a Nix environment.

Running Emacs Haskell Tooling in a Nix environment

A guide to setting up the Haskell tooling for Emacs in a Nix environment.

Suggestions/Contact

mail@sevanspowell.net

Configuration

@geowarin
geowarin / CompletableExecutors.java
Created June 12, 2015 18:34
ExecutorService that handles CompletableFutures
package completable.async;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.*;
import static java.util.concurrent.Executors.callable;
/**
@runarorama
runarorama / gist:33986541f0f1ddf4a3c7
Created May 7, 2015 14:06
Higher-kinded types encoded as path-dependent types
trait λ {
type α
}
trait Functor extends λ {
type α <: λ
def map[A,B](x: α { type α = A })(f: A => B): α { type α = B }
}
import Test.QuickCheck
import Control.Applicative ((<$>))
import Data.List (scanl)
-- To test whether my timsort implementation has the bug described in
-- http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/
-- Answer: yes :-(
runLengthInvariantBroken :: (Num i, Ord i) => i -> i -> i -> i -> Bool
runLengthInvariantBroken a b c i = (b - a <= i - b) || (c - b <= i - c)
Require Import List.
Import ListNotations.
Set Implicit Arguments.
Fixpoint reverse (X: Type) (xs: list X): list X :=
match xs with
| [] => []
| x :: xs' => reverse xs' ++ [x]
end.
@AlexCharlton
AlexCharlton / osc52e.el
Last active June 16, 2021 12:00
Copy text from emacs into xterm, hterm, trough screen and tmux, with support for graphical displays and multi-byte characters
;;;; This script can be loaded during emacs initialization to automatically
;;;; send `kill-region' and `kill-ring-save' regions to your system clipboard.
;;;; The OSC 52 terminal escape sequence is used to transfer the selection from
;;;; emacs to the host terminal.
;;;; It is based off of the osc52.el copyright the Chromium OS authors, but
;;;; was modified to add support for tmux, graphical displays, and
;;;; multi-byte strings.
;;;; It works in hterm, xterm, and other terminal emulators which support the
@markhibberd
markhibberd / Aaa-notes.md
Last active August 29, 2015 13:59
lots of questions

So what I understand to be your questions:

  1. What is a coherency problem?
  2. What does over constained code look like / cause?
  3. How do you lose your "desired" instance?

A way to step through understanding this problem:

  • Oh shit, If I have local type classes, I have to handle crazy wacky cases in my implementation, this will likely have performance and correctness implications (see Coherency.scala)
  • What happens if I close over constraint on construction? Oops if I close over it, I end up with OverConstrained code (see OverConstrainedCode.scala) and worse I still have coherency issues, and the ability to lose my intended behavious (LosingAnInstance.scala)
  • Oh wow, if I just don't do local type classes, by never define conflicting implicits, and ascribe a single type to each behaviour, everything is simple and just works.
@softprops
softprops / jvm_tools.md
Last active August 29, 2015 13:57
some ( not all ) helpful tools the jvm provides out of the box
  • hprof a builtin java agent which dumps profiling info at runtime
  • class sharing class file cache used for faster startup times
  • pack200 unpack200 uber packed jars
  • mission control a Profiling, Monitoring, and Diagnostics Tools Suite
  • jstat performance stats tool
  • jhat heap dump browser
  • jmap memory maps
  • jstack prints stack trace of running process
@msmuenchen
msmuenchen / gist:9318327
Last active September 18, 2022 21:53
KeePass v2.x (KDBX v3.x) file format
Convention: Byte array notation as it would appear in a hexeditor.
= Layout=
KDBX files, the keepass database files, are layout as follows:
1) Bytes 0-3: Primary identifier, common across all kdbx versions:
private static $sigByte1=[0x03,0xD9,0xA2,0x9A];
2) Bytes 4-7: Secondary identifier. Byte 4 can be used to identify the file version (0x67 is latest, 0x66 is the KeePass 2 pre-release format and 0x55 is KeePass 1)
@master-q
master-q / Compare.txt
Last active August 29, 2015 13:56
Compare ATS2/Ajhc/Idris
### Versions
casper$ patsopt --version
Hello from ATS2(ATS/Postiats)!
ATS/Postiats version 0.0.6 with Copyright (c) 2011-2014 Hongwei Xi
casper$ ajhc --version
ajhc 0.8.0.11 (e601dfc26abce79686e41c2609ed5beb7fd7f4d5)
compiled by ghc-7.6 on a x86_64 running linux
casper$ idris --version
Idris version 0.9.11.2