Skip to content

Instantly share code, notes, and snippets.

@refi64
refi64 / sbt.k
Created July 27, 2020 01:48
Stern-brocot tree search in K
/ square root of double precision epsilon (sqrt(2^-52))
E:1.4901161193847656e-8
/ abs[x]: absolute value of x
abs::$[x>0;x;-x]
/ xeq[x;y]: tests if x and y are approximately equal (difference is <sqrt(epsilon))
xeq::E>abs x-y
/ sb[q] Stern-brocot tree search, e.g. sbt[1%3] returns (1 3)
sbt:{[q]+/({[q;LH]~xeq[q;%/+/LH]}q;{[q;L;H]$[q>%/M:L+H;(M;H);(L;M)]}[q].)/:(0 1;1 0)}
/ benchmark:
@refi64
refi64 / main.dart
Created May 19, 2020 18:31
Dart "protected methods" via interfaces & mixins
abstract class MyType {
void doStuff();
}
mixin MyTypeHelpers {
void protectedUtilityMethod() => print('Protected method');
}
abstract class MyDerivedType implements MyType {
factory MyDerivedType.create() => MyDerivedTypeImpl();
compress:{,/({y,$#x@y}t)'!t:=x}
@refi64
refi64 / README.md
Last active November 29, 2023 15:54
The best GitHub README

kma

Travis CI badge Circle CI badge GitHub Actions badge Coverage badge LGTM badge npm badge pub.dev badge Download count badge

@refi64
refi64 / pid-sock.py
Created December 16, 2019 18:11
pid-sock.py
#!/usr/bin/env python3
import os
import socket
import struct
import subprocess
import sys
def nested(fd):
@refi64
refi64 / syyu.md
Created May 3, 2019 18:13 — forked from Brottweiler/syyu.md
pacman -Syyu vs. pacman -Syu

pacman -Syu

  • User: Hey server do you have any new packages or updates or changes at all
  • Server: no
  • User: Ok bye

pacman -Syyu

  • User: hey server do you have any new packages or updates at all
  • Server: no
@refi64
refi64 / SOS.md
Created May 3, 2019 18:10 — forked from vodik/SOS.md
_Never_ -Sy when installing!

Once upon a time there was a user that wanted to install firefox.

The user tried to do pacman -S firefox but it didn't work. The all mighty pacman reported that firefox-3.2.4-1.i686.pkg.tar.gz could not be found on his mirror. So the user tried pacman -Sy firefox. It worked and the user rejoiced since he could once again go and troll /h/.

But all was not good. The user had made a grave error!

See, when the user told the almighty pacman to -Sy firefox, pacman did

@refi64
refi64 / keybase.md
Created March 26, 2019 13:23
keybase.md

Keybase proof

I hereby claim:

  • I am refi64 on github.
  • I am refi64 (https://keybase.io/refi64) on keybase.
  • I have a public key ASC0MAUdoo0JtC9sw5EKyAwgpeBm0nFIDeLLNJj5mrH2Vwo

To claim this, I am signing this object:

@refi64
refi64 / org.gtk.Gtk3theme.Bubble-Dark-Blue.appdata.xml
Created February 16, 2019 02:47
Bubble Dark Blue Flatpak manifest
<?xml version="1.0" encoding="UTF-8"?>
<component type="runtime">
<id>org.gtk.Gtk3theme.Bubble-Dark-Blue</id>
<metadata_license>CC0-1.0</metadata_license>
<name>Bubble Dark Blue Gtk theme</name>
<summary>Bubble Dark Blue Gtk theme</summary>
<description>
<p>Bubble Dark Blue is a theme for Gtk3.</p>
</description>
<url type="homepage">https://www.gnome-look.org/p/1253999/</url>