Skip to content

Instantly share code, notes, and snippets.

View arnihermann's full-sized avatar
💭
¯\_(ツ)_/¯

Árni Hermann Reynisson arnihermann

💭
¯\_(ツ)_/¯
View GitHub Profile
@arnihermann
arnihermann / SVS.js
Created September 15, 2021 20:16 — forked from fsjuhl/SVS.js
const blockhash = "0x5cb3e33c31019c9e5f77f354f150e4d74eb95a029a69738d45c176bc1447e444"
const fs = require("fs").promises
const seedrandom = require("seedrandom")
const chooser = require("random-seed-weighted-chooser").default
const SparkMD5 = require("spark-md5")
const random = seedrandom(blockhash)
const uniques = [{
@arnihermann
arnihermann / IRC.md
Created September 13, 2021 12:48 — forked from rain-1/IRC.md
why we use IRC nodes

Why is IRC distributed across multiple servers?

I have been wondering for a long time why IRC networks have multiple servers. Wouldn't it be simpler just to use a single server?

One of the problems of having multiple servers is that netsplits can occur. Anybody who has been on IRC for a while will have witnessed one. Hundreds of people suddenly ripped out of the chat. This can also screw up channel and user modes, and 'some people' have been known to wait for netsplits in order to takeover channels or enter password protected channels.

So lets compare situation (A) a single IRC server everyone connects to with the current setup people use (B) multiple servers. Let's say you run an IRC network with u = 40,000 users and n = 20 server nodes that people connect to via round robin DNS (meaning that when people resolve the DNS it gives them a random server from the set of 20 to connect to). These are vaguely realistic numbers modelled after libera.chat.

So in (B) you have roughly u/n = 2000 clients connected

@arnihermann
arnihermann / resign_ipa.md
Created September 25, 2017 20:08 — forked from wli/resign_ipa.md
Expo build with associatedDomains

Resign Expo IPA for associatedDomains

You can also generalize these instructions to modify your ipa for any other reason.

Error message

ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, value '*' for key 'com.apple.developer.associated-domains' in 'Payload/Exponent.app/Exponent' is not supported."

Assumptions

  • My app id is io.getsparks.sparks
  • My distribution certificate name is iPhone Distribution: Boost Labs, Inc
define(['transit', 'immutable'], function (Transit, Imm) {
'use strict';
var reader = Transit.reader('json', {
arrayBuilder: {
init: function () { return Imm.List.of().asMutable(); },
add: function (ret, val) { return ret.push(val); },
finalize: function (ret) { return ret.asImmutable(); },
fromArray: function (arr) { return Imm.List(arr); }
},

Keybase proof

I hereby claim:

  • I am arnihermann on github.
  • I am arnihermann (https://keybase.io/arnihermann) on keybase.
  • I have a public key whose fingerprint is 9F75 04B0 AF13 98CF 0AFB 6213 08F0 AD45 C20D 6EED

To claim this, I am signing this object:

@arnihermann
arnihermann / gist:5091145
Last active December 14, 2015 13:08
Either.cs
public abstract class Either<A, B>
{
private Either() { }
abstract public T Fold<T>(Func<A, T> leftFold, Func<B, T> rightFold);
abstract public bool HasError { get; }
public sealed class Left<A, B> : Either<A, B>
{
@arnihermann
arnihermann / gameoflife.hs
Created January 7, 2013 01:40
runhaskell gameoflife.hs
import Control.Monad (forM_)
import Data.Function (on)
import Data.List (group,intercalate,maximumBy,nub,sort)
import Data.List.Split (chunksOf)
-- see http://clj-me.cgrand.net/2011/08/19/conways-game-of-life/
neighbours [x, y] = [[dx + x, dy + y] | dx <- [-1,0,1]
, dy <- if (dx == 0) then [-1,1] else [-1,0,1]]
import Data.List (findIndex)
import Data.Maybe (maybe)
main = do
let fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
idx = findIndex (\n -> length (show n) == 1000) fibs
putStrLn $ maybe "no fib found" show idx
➜ osxmonad git:(master) cabal install
Resolving dependencies...
Configuring osxmonad-0.1.0.0...
Building osxmonad-0.1.0.0...
Preprocessing library osxmonad-0.1.0.0...
[3 of 3] Compiling OSXMonad.Core ( OSXMonad/Core.hs, dist/build/OSXMonad/Core.o )
OSXMonad/Core.hs:205:14:
The function `C.XConf' is applied to 10 arguments,
but its type `XM.Display
@arnihermann
arnihermann / tree.md
Created April 23, 2012 22:58 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!