Skip to content

Instantly share code, notes, and snippets.

Avatar
✍️
Tinkering Sedulously

Terkwood Terkwood

✍️
Tinkering Sedulously
View GitHub Profile
@Terkwood
Terkwood / install_elixir.md
Created Jul 12, 2021 — forked from rubencaro/install_elixir.md
Elixir installation guide
View install_elixir.md

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then asdf is your best friend.

@Terkwood
Terkwood / Lambda.scala
Created Mar 8, 2021 — forked from RaasAhsan/Lambda.scala
Type-level, untyped lambda calculus in Scala 3
View Lambda.scala
object Lambda extends App {
sealed trait Term
sealed trait Var[I <: Index] extends Term
sealed trait App[T1 <: Term, T2 <: Term] extends Term
sealed trait Abs[T1 <: Term] extends Term
sealed trait If[T1 <: Term, T2 <: Term, T3 <: Term] extends Term
sealed trait Bool[T1 <: Boolean] extends Term
sealed trait Index
View global-gitignore.md

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore
View Inject javascript into HTML pages from console.md

#Inject javascript into HTML pages from console

An easy way to inject Javascripts into the current loaded dom using the developer console in chrome.

jQuery

var script = document.createElement('script');
script.src = 'http://code.jquery.com/jquery-1.7.2.min.js';
@Terkwood
Terkwood / gist:89348347bb11ed58d7b38c1d5217de67
Created Jan 17, 2021 — forked from danking/gist:1068185
A very simple example showing how to use Racket's lexing and parsing utilities
View gist:89348347bb11ed58d7b38c1d5217de67
#lang racket
(require parser-tools/lex
(prefix-in re- parser-tools/lex-sre)
parser-tools/yacc)
(provide (all-defined-out))
(define-tokens a (NUM VAR))
(define-empty-tokens b (+ - EOF LET IN))
(define-lex-trans number
(syntax-rules ()
@Terkwood
Terkwood / writeup.md
Created Nov 30, 2020 — forked from edmundsmith/writeup.md
Method for Emulating Higher-Kinded Types in Rust
View writeup.md

Method for Emulating Higher-Kinded Types in Rust

Intro

I've been fiddling about with an idea lately, looking at how higher-kinded types can be represented in such a way that we can reason with them in Rust here and now, without having to wait a couple years for what would be a significant change to the language and compiler.

There have been multiple discussions on introducing higher-ranked polymorphism into Rust, using Haskell-style Higher-Kinded Types (HKTs) or Scala-looking Generalised Associated Types (GATs). The benefit of higher-ranked polymorphism is to allow higher-level, richer abstractions and pattern expression than just the rank-1 polymorphism we have today.

As an example, currently we can express this type:

@Terkwood
Terkwood / sccache-trimmed.txt
Created May 12, 2020
sccache example (trimmed)
View sccache-trimmed.txt
Compile requests 5063
Compile requests executed 971
Cache hits 558
Cache misses 410
Compilation failures 3
Non-cacheable calls 4092
Average cache write 0.002 s
Average cache read miss 2.511 s
Average cache read hit 0.007 s
@Terkwood
Terkwood / brainfuck.hs
Created Apr 23, 2020 — forked from elyatai/brainfuck.hs
A brainfuck interpreter written in Haskell typeclasses
View brainfuck.hs
{-# LANGUAGE
TypeOperators, MultiParamTypeClasses, FunctionalDependencies,
FlexibleInstances, UndecidableInstances
#-}
module Brainfuck where
{- Usage:
Programs are encoded as cons-lists chained by (:-) and terminated by C0.
@Terkwood
Terkwood / README.md
Created Mar 20, 2020 — forked from tetkuz/README.md
GStreamer stream to HTML5
View README.md

Description

[Server] GStreamer ---> HTML [Client]

Require

  • gstreamer-1.x
  • Browser which supports video tag of HTML5

debian

@Terkwood
Terkwood / build_VC4CL_rpi_3Bplus.sh
Last active Mar 1, 2020 — forked from aumouvantsillage/Building VC4CL
Building VC4C and VC4CL on a Raspberry Pi 3 with Raspbian Stretch
View build_VC4CL_rpi_3Bplus.sh
sudo apt install git cmake clang-3.9 opencl-headers ocl-icd-dev ocl-icd-opencl-dev
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-3.9 100
git clone https://github.com/doe300/VC4C.git
git clone https://github.com/doe300/VC4CL.git
git clone https://github.com/doe300/VC4CLStdLib.git
cd VC4C
cmake -DBUILD_TESTING=OFF -DSPIRV_FRONTEND=OFF