Skip to content

Instantly share code, notes, and snippets.

Avatar

dicioccio lucas lucasdicioccio

View GitHub Profile
@lucasdicioccio
lucasdicioccio / scripts.md
Last active Sep 9, 2021
nautilus scripts for Ubuntu
View scripts.md

convert a screencast

If you record screen with (ctrl+shift+alt+R) in Ubuntu, you'll get a webm file, GitHub wants mp4. So you need to convert from webm to mp4.

The ffmpeg command allows such a conversion. Ubuntu's file navigator allows to have some right-click scripts shortcuts.

To be dropped and chmod +x in something like ~/.local/share/nautilus/scripts/ffmpeg convert to mp4

@lucasdicioccio
lucasdicioccio / example-usage.md
Created Jun 5, 2021
a Haskell script to detect garbled files on a shitty SD
View example-usage.md

Compile then run

$ ghc --make -O2 suspicious.hs
$ find . -name "IMG_*" -exec './suspicious' '{}' \; > suspicious-list

Excerpt of the output in suspicious-list:

@lucasdicioccio
lucasdicioccio / bookmarklet.md
Created Feb 26, 2021
postgrest-table bookmarklet
View bookmarklet.md

Postgrest-Table bookmarklet

https://postgrest-table.netlify.app/ turns you PostgREST endpoint in some default view to discover and browse tables.

The bookmarklet to save is:

javascript:location.href='https://postgrest-table.netlify.app?postgrest='+document.location.href;
@lucasdicioccio
lucasdicioccio / mzn.vim
Last active May 3, 2020
a VIM syntax highlight for MiniZinc
View mzn.vim
" Vim syntax file
" Language: MiniZinc
" Maintainer: Lucas DiCioccio
" Latest Revision: 02 May 2020
if exists("b:current_syntax")
finish
endif
" keywords
View workaround-warp
user@vm051:~/wai$ git diff
diff --git a/warp/Network/Wai/Handler/Warp/HTTP2/Receiver.hs b/warp/Network/Wai/Handler/Warp/HTTP2/Receiver.hs
index 3000baa..7bd8604 100644
--- a/warp/Network/Wai/Handler/Warp/HTTP2/Receiver.hs
+++ b/warp/Network/Wai/Handler/Warp/HTTP2/Receiver.hs
@@ -165,26 +165,29 @@ frameReceiver ctx mkreq recvN = loop 0 `E.catch` sendGoaway
Nothing
| isResponse streamId -> return Nothing
| otherwise -> do
- when (ftyp `notElem` [FrameHeaders,FramePriority]) $
@lucasdicioccio
lucasdicioccio / freet.hs
Last active Apr 12, 2016
subtle free monads
View freet.hs
{-# LANGUAGE DeriveFunctor #-}
module Main where
import Control.Monad.IO.Class
import Control.Monad.State
import Control.Monad.Trans.Free
data MyFunctor next = PrimitiveA next | PrimitiveB next deriving Functor
type MyFreeT m = FreeT MyFunctor m
type Program = MyFreeT (StateT Int IO)
@lucasdicioccio
lucasdicioccio / GildedTulip.hs
Last active Mar 19, 2019
What an immutable GildedRose would look like
View GildedTulip.hs
-- An alternative GildedRose using an immutable approach.
-- Context on the GildedRose:
-- * http://blog.lunarlogic.io/2015/what-ive-learned-by-doing-the-gilded-rose-kata-4-refactoring-tips/
-- * my comment in the linked blog post
-- One could take this GildedTulip approach and encapsulate a similar "immutable API"
-- to re-create the "mutable API" of the GildedRose.
--
-- This example is written in Haskell. This example uses three notable features (available in other languages):
-- - pattern matching: a way to hide a lot of "if"