Skip to content

Instantly share code, notes, and snippets.

View np's full-sized avatar

Nicolas Pouillard np

View GitHub Profile
@ekmett
ekmett / TypedNBE.hs
Last active September 7, 2020 19:37
Typed normalization-by-evaluation using a slowed category action
{-# Language CPP #-}
{-# Language BlockArguments #-}
{-# Language GADTs #-}
{-# Language RankNTypes #-}
{-# Language ViewPatterns #-}
{-# Language TypeApplications #-}
{-# Language BangPatterns #-}
{-# Language TypeOperators #-}
{-# Language TypeFamilyDependencies #-}
{-# Language DataKinds #-}
@mminer
mminer / dockerpsjson.py
Last active June 4, 2023 11:36
Shell script thats prints the output of `docker ps` in JSON format.
#!/usr/bin/env python3
"""Parses and encodes the result of `docker ps` in JSON format."""
import json
import sys
from collections import namedtuple
from subprocess import Popen, PIPE
@freakhill
freakhill / list_comprehension.rb
Last active December 17, 2015 06:19
having fun with "haskell like list comprehension in ruby" - https://gist.github.com/andkerosine/3356675
#!/usr/bin/env ruby-head
class VeryBasicObject < BasicObject
undef :==
undef :!=
undef :!
end
class Captured < VeryBasicObject
def method_missing meth, *args
@quchen
quchen / trolling_haskell
Last active February 24, 2024 01:30
Trolling #haskell
13:15 <xQuasar> | HASKELL IS FOR FUCKIN FAGGOTS. YOU'RE ALL A BUNCH OF
| FUCKIN PUSSIES
13:15 <xQuasar> | JAVASCRIPT FOR LIFE FAGS
13:16 <luite> | hello
13:16 <ChongLi> | somebody has a mental illness!
13:16 <merijn> | Wow...I suddenly see the error of my ways and feel
| compelled to write Node.js!
13:16 <genisage> | hi
13:16 <luite> | you might be pleased to learn that you can compile
| haskell to javascript now
@np
np / asking.sh
Last active December 14, 2015 15:28
A shell function to ask the user to answer a Yes/No question.
# asking() @ https://gist.github.com/np/5107721#file-asking-sh {{{
# Dependencies:
# error() @ https://gist.github.com/np/3736727#file-error-sh
# Options:
# --default=no Makes No being the default (--default=yes is the default)
# --no-slmenu Do no use slmenu even if available
# Examples:
# asking 'Something failed, do you still want to continue?'
# asking --default=yes 'Next step?'
asking(){
@np
np / error.sh
Last active October 10, 2015 19:07
Simple 'error' function in shell
# error() @ https://gist.github.com/np/3736727#file-error-sh {{{
# Takes an exit code and a message, prints the message and then exits
error(){
local code="$1"
shift
echo "error: $@" >>/dev/stderr
exit "$code"
}
# }}}
@andkerosine
andkerosine / raskell.rb
Created August 15, 2012 05:56
Haskell-like list comprehensions in Ruby
$stack, $draws = [], {}
def method_missing *args
return if args[0][/^to_/]
$stack << args.map { |a| a or $stack.pop }
$draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :<
end
class Array
def +@
@np
np / link.sh
Last active October 7, 2015 14:48
link
@comboy
comboy / update.rb
Created June 18, 2011 22:11
update all your namecoin domains
require 'json'
# put this file in the same dir as namecoind executable
JSON.load(`./namecoind name_list`).each do |domain|
if domain['expires_in'] < 5000
command = "./namecoind name_update '#{domain['name']}' '#{domain['value']}'"
puts command
puts `#{command}`
end