Skip to content

Instantly share code, notes, and snippets.

View pedrofurla's full-sized avatar

Pedro Furlanetto pedrofurla

View GitHub Profile
@Gabriella439
Gabriella439 / lfp.md
Last active March 18, 2022 17:39
Introduction for "Lightweight Functional Programming Specification"

Lightweight Functional Programming specification

The purpose of this document is to specify a baseline set of functional programming features that users can request and that programming languages can advertise support for. This feature set strives to be "JSON-like" and "purely functional".

The goals of this specification are (in descending order of importance):

  • Cultivate a portable functional programming style
// Which of f or g are more readable, and if possible, why?
def f(x: Seq[Int]): Int =
x.toList match {
case Nil => 99
case lst => lst.sum
}
def g(x: Seq[Int]): Int =
x.toList match {
@pedrofurla
pedrofurla / postgres_queries_and_commands.sql
Created April 9, 2020 02:15 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@ChrisPenner
ChrisPenner / Optics Cheatsheet.md
Last active April 12, 2024 14:24
Optics Cheatsheet
@chrisdone
chrisdone / 0README.md
Last active November 8, 2020 09:49
total-eval.hs

Total (non-error-throwing) lambda-calculus evaluators.

@puffnfresh
puffnfresh / default.nix
Last active June 14, 2019 05:49
ghc not found patch for haskell.nix
{ pkgs ? import <nixpkgs> {} }:
let
haskell = import (builtins.fetchTarball https://github.com/input-output-hk/haskell.nix/archive/master.tar.gz) { inherit pkgs; };
happyHack = config:
let inherit (config.hsPkgs) happy;
in "export happy_datadir=${happy.components.exes.happy}/share/${builtins.currentSystem}-ghc-${config.compiler.version}/${happy.identifier.name}-${happy.identifier.version}";
pkgSet = haskell.mkCabalProjectPkgSet {
@JulianNorton
JulianNorton / uninstall-rippling.sh
Created August 13, 2018 22:31
uninstall rippling
#!/bin/bash
if [ `id -u` -ne 0 ]; then
echo "Rippling uninstall must be run by root"
exit 1
fi
sudo launchctl unload /Library/LaunchDaemons/com.rippling.*
sudo rm -rf /Library/LaunchDaemons/com.rippling.*
sudo rm -rf /opt/rippling
@hereismari
hereismari / msi-gtx1060-ubuntu-18.04-deeplearning.md
Last active December 3, 2023 17:14
Setting up a MSI laptop with GPU (gtx1060), Installing Ubuntu 18.04, CUDA, CDNN, Pytorch and TensorFlow
@Icelandjack
Icelandjack / SystemF.hs
Last active November 27, 2018 02:00
System F
-- SYSTEM F
-- http://homepages.inf.ed.ac.uk/slindley/papers/embedding-f.pdf
--
-- Type-level lambdas
-- https://gist.github.com/AndrasKovacs/ac71371d0ca6e0995541e42cd3a3b0cf
{-# language TemplateHaskell, ScopedTypeVariables, RankNTypes,
TypeFamilies, UndecidableInstances, DeriveFunctor, GADTs,
TypeOperators, TypeApplications, AllowAmbiguousTypes,
@rahulmutt
rahulmutt / Main-Decompiled.java
Last active September 12, 2017 04:34
Polymorphism in Eta via Type Erasure
public static class id extends Function {
public Closure enter(StgContext context) {
// context.R(2) is the first argument of the function
// All id simply does is evaluate the argument -
// it cannot do much more!
return context.R(2).evaluate(context);
}
public int arity() { return 1; }
}