Skip to content

Instantly share code, notes, and snippets.

View arialdomartini's full-sized avatar

Arialdo Martini arialdomartini

View GitHub Profile
@arialdomartini
arialdomartini / fix-ghci-on-windows.md
Last active July 8, 2023 06:42
Windows GHCI: user specified .o/.so/.DLL could not be loaded

If running GHCI on Windows returns

ghci
GHCi, version 9.4.1: https://www.haskell.org/ghc/  :? for help
<command line>: user specified .o/.so/.DLL could not be loaded (addDLL: pthread or dependencies not loaded. (Win32 error 5))
Whilst trying to load:  (dynamic) pthread
Additional directories searched:   C:/Users/arialdomartini/scoop/apps/haskell/9.4.1/mingw/lib/clang/13.0.0
   C:/Users/arialdomartini/scoop/apps/haskell/9.4.1/lib/../mingw/x86_64-w64-mingw32/lib
 C:/Users/arialdomartini/scoop/apps/haskell/9.4.1/lib/../mingw/lib
@arialdomartini
arialdomartini / yt-to-markdown.el
Last active July 3, 2023 06:47
Download the subtitles from a YouTube video and print it into a markdown tabl
(progn
(defun download-captions (youtube-link)
(shell-command (concat "yt-dlp --write-sub --write-auto-sub --no-warnings --sub-lang en --skip-download --sub-format srv1 -o temp-file -U" youtube-link)))
(defun xml-attribute (name item)
(cdr (assoc name (xml-node-attributes item))))
(defun xml-items (file-path)
(with-temp-buffer
(insert-file-contents file-path)
;; printing the variable name used by the caller
(defmacro name (var)
`(format "Name=%s, Value=%s" ',var ,var))
(let ((x 42))
(name x))
"Name=x, Value=42"
@arialdomartini
arialdomartini / Enums.cs
Created April 24, 2023 18:41
Typesafe Enums with Discriminated Union Types
using Xunit;
namespace CSharpBits.Test;
record Payment
{
internal record Mastercard : Payment;
internal record Visa : Payment;
@arialdomartini
arialdomartini / *.csproj
Created March 21, 2023 17:39
NSubstitute and internal interfaces
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>DynamicProxyGenAssembly2</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
(defun duplicate-line ()
(interactive)
(beginning-of-line)
(let ((from (point)))
(end-of-line)
(let ((to (point)))
(kill-ring-save from to)
(newline)
(yank))))
@arialdomartini
arialdomartini / notes.md
Last active March 15, 2023 05:57
emacs-journey

Emacs 28 -> 30

From emacs 28 to 30, several compilation errors, in particular with straight.el

straight magic

From https://github.com/radian-software/straight.el#packages-and-the-init-file "Note that this means packages installed interactively (using M-x straight-use-package) are not considered part of your Emacs configuration, since the invocation of straight-use-package does not happen in your init-file." How can it be?

Domanda

Inventa una situazione iperbolica e assurda nella quale un giudice preferisce assumere un medriocre suonatore di volpi piuttosto che un sublime pianista. Descrivi le adsurde giustificazioni che questo personaggio potrebbe portare avanti, in un testo di una commedia sulle stolr di Ionescu

Risposta

In un tribunale assurdo, il giudice decise di assumere un suonatore di volpi mediocre piuttosto che un sublime pianista per il suo concerto di beneficenza annuale. Quando gli venne chiesto il motivo di questa decisione incredibile, il giudice rispose con una serie di assurde giustificazioni.

Innanzitutto, il giudice disse che il suonatore di volpi era l'unico che poteva eseguire la famosa "Sinfonia delle Volpi" che era necessaria per l'evento. Inoltre, il giudice affermò che il suonatore di volpi aveva una grande presenza sul palco e sarebbe stato più divertente per il pubblico guardare qualcuno che correva dietro alle volpi piuttosto che ascoltare la sublime melodia del pianista.

Quando gli venne chie

@arialdomartini
arialdomartini / repeat-previous-line-char.el
Created January 9, 2023 10:46
repeat-previous-line-char.el
(defun repeat-previous-line-char (char)
"Repeats a character until the end of previous line."
(interactive "cEnter character to repeat")
(let ((col (save-excursion
(forward-line -1)
(end-of-line)
(current-column))))
(while (< (current-column) col)
(insert char))))
@arialdomartini
arialdomartini / palindrome.hs
Last active October 12, 2022 17:04
largest-palindrome
calculateLargest :: Int
calculateLargest = largest (100,100) 0
next :: (Int, Int) -> (Int, Int)
next (x, 999) = (x+1, 100)
next (x, y) = (x, y+1)
largest :: (Int, Int) -> Int -> Int
largest (1000, _) champion = champion
largest counter@(x,y) champion =