Skip to content

Instantly share code, notes, and snippets.

@thalesmg
thalesmg / vgmrips-auto-tocar.user.js
Last active September 2, 2020 23:45
Auto Random Play VGMRips
// -*- mode: js2 -*-
// ==UserScript==
// @name VGMRips Auto Random
// @namespace https://userscripts-mirror.org/users/529924
// @include https://vgmrips.net/*
// @require https://vgmrips.net/packs/js/jquery-1.11.0.min.js
// @author Thales M. G.
// @version 1.0.1
// @grant none
// @run-at document-idle
@thalesmg
thalesmg / config.dhall
Last active October 27, 2024 21:05
sync-git.hs
let GitRepo =
{ Type = { repoPath : Text, name : Text, commands : List Text }
, default.commands =
[ "git pull", "git push origin master", "git fetch -pa" ]
}
let Config =
{ Type = { concurrency : Natural, repos : List GitRepo.Type }
, default = { concurrency = 7, repos = [] : List GitRepo.Type }
}
@thalesmg
thalesmg / tmg-webp2mp4.hs
Created October 12, 2020 17:59
Conversor de webp animado para mp4
#!/usr/bin/env stack
{-
stack --resolver lts-16.18 script
--package turtle
--package text
-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
module Main where
@thalesmg
thalesmg / config.dhall
Last active October 28, 2020 21:40
Meme clipboard copier with Rofi
let Meme =
{ Type = { path : Text, description : Text, slug : Text }, default = {=} }
let basePath = "/home/thales/Pictures/zoeira/"
let memePath = λ(file : Text) → basePath ++ file
let memes =
[ Meme::{
, path = memePath "eyebrows.gif"
@thalesmg
thalesmg / remove_google_annoyances.user.js
Last active October 23, 2020 18:26
remove annoying google ads and people also search for
// ==UserScript==
// -*- mode: js2; -*-
// @name Remove ads from google search
// @namespace https://userscripts-mirror.org/users/529924
// @include *://*google.com*/search?*
// @include *://*google.com*/#fp=*
// @include *://*google.com*/webhp?tab=*
// @include *://*google.com*/?gws_rd*
// @include *://*google.com*/#newwindow*
// @grant none
@thalesmg
thalesmg / gist:f759f79c32efeaff655582904885cb2c
Created November 2, 2020 22:22 — forked from sebfisch/gist:2235780
Laymans explanation of delimited continuations with examples of using them for exception handling and nondeterministic programming.

Delimited Continuations

Delimited continuations manipulate the control flow of programs. Similar to control structures like conditionals or loops they allow to deviate from a sequential flow of control.

We use exception handling as another example for control flow manipulation and later show how to implement it using delimited continuations. Finally, we show that nondeterminism can also be expressed using delimited continuations.

Exception Handling

@thalesmg
thalesmg / juxt.idr
Created November 14, 2020 18:27
Attempt at defining Clojure's `juxt` using dependent types in Idris
module Juxt
import Data.HVect
import Data.Vect
From : Type -> Vect n Type -> Vect n Type
From a [] = []
From a (x :: xs) = (a -> x) :: From a xs
juxt : {k : Nat} -> {ts : Vect k Type} -> HVect (From a ts) -> a -> HVect ts
@thalesmg
thalesmg / readme.md
Created January 25, 2021 13:36
Testing simple state transition checking with SBV
problem 0
BMC: Iteration: 0
BMC: Iteration: 1
BMC: Iteration: 2
BMC: Iteration: 3
BMC: Iteration: 4
BMC: Iteration: 5
BMC: Solution found at iteration 5
Right (5,[S (Stopped,10),S (Down,8),S (Down,6),S (Down,4),S (Down,2),S (Down,0)])
@thalesmg
thalesmg / world-building-with-tom-harding.md
Created February 7, 2021 21:14 — forked from sjsyrek/world-building-with-tom-harding.md
World-Building in Haskell with Tom Harding
@thalesmg
thalesmg / desafio2.hs
Created February 27, 2021 23:48
Exemplo de uso do SBV (SMT Solver) para resolver desafio de lógica
#!/usr/bin/env stack
{-
stack --resolver lts-17.4 script
--package sbv
-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE StandaloneDeriving #-}