Skip to content

Instantly share code, notes, and snippets.

@ellbur
ellbur / Target.scala
Created January 12, 2021 03:55
Dirt-simple reactive signals in Scala 3
package signals
import scala.collection.mutable
trait Target[+A] {
def rely(upset: () => () => Unit): (A, Cancellable)
import TrackingUtils.tracking
def map[B](f: A => B): Target[B] = tracking { f(this.track) }
@ellbur
ellbur / rename-things.raku
Created December 25, 2020 20:02
Find and replace in multiple files with Raku
#!/usr/bin/rakudo
# vim: ft=perl6
use File::Temp;
my $here = $*PROGRAM.parent;
sub process-py-file($f) {
say $f;
$ sudo apt install -oDebug::pkgAcquire::Worker=1 neovim
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libc-l10n libpython3.7-minimal libpython3.7-stdlib python3.7 python3.7-minimal
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
gcc-10-base libapt-pkg6.0 libc-bin libc6 libcrypt1 libffi7 libgcc-s1 libice6 liblua5.1-0 libmsgpackc2 libpython3-stdlib libpython3.8-minimal libpython3.8-stdlib libreadline8 libsm6
libstdc++6 libtermkey1 libunibilium4 libuv1 libvterm0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmu6 libxmuu1 libxt6 locales lua-bitop lua-luv neovim-runtime python3
@-moz-document domain("stackedit.io") {
.layout__panel--explorer, .layout__panel--side-bar {
background-color: #333;
}
body {
color: #b1b1b1;
}
export QT_QPA_PLATFORM=wayland
export GDK_BACKEND=wayland
export CLUTTER_BACKEND=wayland
export XDG_RUNTIME_DIR=/var/run/chrome
export WAYLAND_DISPLAY=wayland-0
@-moz-document regexp("https://.*instructure.com/.*") {
p{
font-size:17px;
}
body {
min-height: 100vh;
background: #2b2b2b;
color: #c3c3c3;
font-weight: 300;
}
@-moz-document domain("casetext.com") {
body, ul, article {
background-color: #333 !important;
}
div, span, span::before {
background: transparent !important;
}
@ellbur
ellbur / subtle_notifications.lua
Created January 27, 2020 14:09
Subtle notification area for awesomewm that won't cover windows
notification_box = wibox.widget {
text = '',
align = 'left',
valign = 'center',
widget = wibox.widget.textbox
}
notification_timer = nil
naughty.dbus.config.mapping = {
import scala.language.higherKinds
object DependentStorageTest extends App {
def decidableEquality[X <: AnyRef, Y <: AnyRef](x: X)(y: Y): Option[x.type =:= y.type] =
if (x eq y)
Some(=:=.tpEquals[x.type].asInstanceOf[x.type =:= y.type])
else
None