Skip to content

Instantly share code, notes, and snippets.

View ga2arch's full-sized avatar
🐢

Gabriele Carrettoni ga2arch

🐢
View GitHub Profile
@ga2arch
ga2arch / gist:6ede688266a24c5714ae5b67c0b19640
Created June 14, 2021 22:13 — forked from d-t-w/gist:a239dfca4f57b7ff6f38c895b7f45405
Intellij Cursive+Cljfmt Editor CodeStyle
<code_scheme name="TW" version="173">
<ClojureCodeStyleSettings>{
:cljs.core/as-&gt; :only-indent
:cljs.core/assoc 0
:cljs.core/cond-&gt; :only-indent
:cljs.core/cond-&gt;&gt; :only-indent
:cljs.core/defonce :only-indent
:cljs.core/with-meta :only-indent
:cljs.core.async/go :only-indent
:cljs.core.async/go-loop :only-indent
@ga2arch
ga2arch / gist:8fdc68bad3794bd1e540d9bb59de3a47
Created April 10, 2016 21:17 — forked from patshaughnessy/gist:70519495343412504686
How to Debug Postgres using LLDB on a Mac
This note explains how to build Postgres from source and setup to debug it using LLDB on a Mac. I used this technique to research this article:
http://patshaughnessy.net/2014/10/13/following-a-select-statement-through-postgres-internals
1. Shut down existing postgres if necessary - you don’t want to mess up your existing DB or work :)
$ ps aux | grep postgres
pat 456 0.0 0.0 2503812 828 ?? Ss Sun10AM 0:11.59 postgres: stats collector process
pat 455 0.0 0.0 2649692 2536 ?? Ss Sun10AM 0:05.00 postgres: autovacuum launcher process
pat 454 0.0 0.0 2640476 304 ?? Ss Sun10AM 0:00.74 postgres: wal writer process
pat 453 0.0 0.0 2640476 336 ?? Ss Sun10AM 0:00.76 postgres: writer process
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Control.Monad.IO.Class
import Control.Monad.Trans.Class
import Prelude hiding (log)
--------------------------------------------------------------------------------
-- The API for cloud files.
class Monad m => MonadCloud m where
saveFile :: Path -> Bytes -> m ()
@ga2arch
ga2arch / .gitignore
Last active August 29, 2015 14:08 — forked from adamgit/.gitignore
# OS X temporary files that should never be committed
#
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
.DS_Store
# c.f. http://www.westwind.com/reference/os-x/invisibles.html
.Trashes
@ga2arch
ga2arch / fsevent.cpp
Last active August 29, 2015 14:07 — forked from yangacer/fsevent.cpp
#include <CoreServices/CoreServices.h>
#include <iostream>
void callback(
ConstFSEventStreamRef stream,
void *callbackInfo,
size_t numEvents,
void *evPaths,
const FSEventStreamEventFlags evFlags[],
const FSEventStreamEventId evIds[])
@ga2arch
ga2arch / progbar.hs
Last active August 29, 2015 14:01 — forked from adinapoli/progbar.hs
{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
module Main where
import Data.ByteString (ByteString)
import System.IO.Streams (InputStream, OutputStream)
import Network.Http.Client
import Text.Printf (printf)
import qualified Data.ByteString as B
import qualified Data.ByteString.Char8 as C8

I like LYAH as a reference and cheat-sheet but I found it a little slow for learning Haskell.

Here's my recommended order for just learning Haskell:

http://yannesposito.com/Scratch/en/blog/Haskell-the-Hard-Way/ 80% completion here is fine if you feel your attention waning, the next thing will address hammering in things like functors and monads via typeclasses.

https://github.com/NICTA/course/ this will hammer in the lessons in a very direct form by forcing you to confront the challenges and lessons learned by the creators and community of Haskell itself. Doing the exercises here is critical for being fluent.

Real World Haskell is available online. (Thanks bos!)

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
@ga2arch
ga2arch / gist:4055118
Created November 11, 2012 14:51 — forked from phimuemue/gist:1056235
Quick and dirty unification algorithm
-- simple unification for predicate logic
data AtomicFormula = Variable String | -- single variable
Function String [AtomicFormula] -- function with some args
instance Show AtomicFormula where
show (Variable a) = a
show (Function f l) = f ++ (show l)
data Formula = And Formula Formula -- conjunction, not needed
@ga2arch
ga2arch / maze.clj
Created January 21, 2012 20:09 — forked from cgrand/maze.clj
A maze generator (Wilson's algorithm) which can work with any topography (hextiles, torus variants, teapot etc.)
; http://groups.google.com/group/clojure/browse_thread/thread/974e2c7f89e27231/5f4bff3e58dfa36f
; output images http://i.imgur.com/gSASS.png (square maze)
; http://i.imgur.com/uEqaq.png (hex maze)
;; generic Wilson's algorithm implementation
(defn maze
"Returns a random maze carved out of walls; walls is a set of
2-item sets #{a b} where a and b are locations.
The returned maze is a set of the remaining walls."
[walls]