View buffer-test.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.actor.ActorSystem | |
import akka.stream.Attributes | |
import akka.stream.scaladsl.Source | |
import monix.execution.rstreams.Subscription | |
import org.reactivestreams.{ Publisher, Subscriber } | |
import scala.concurrent.{ Await, ExecutionContext, Future } | |
import scala.concurrent.duration._ | |
def repeated[A](x: A)(f: A => A)(implicit ec: ExecutionContext): Publisher[A] = |
View send-mail.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import smtplib | |
import argparse | |
from datetime import datetime, timedelta | |
from email.message import EmailMessage | |
parser = argparse.ArgumentParser(description='Send email') |
View send-mail.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import smtplib | |
import argparse | |
from datetime import datetime, timedelta | |
from email.message import EmailMessage | |
parser = argparse.ArgumentParser(description='Send email') |
View encrypt.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# Quickly encrypt a message or a file for sending to | |
# your colleagues over unsecure messengers (Slack, etc)... | |
# | |
# echo "secret message" | encrypt | |
# | |
# Or to encrypt a file: | |
# | |
# encrypt ./path/to/file |
View sierpinski.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env stack | |
-- stack --resolver lts-14.14 script | |
import Data.Bits | |
main :: IO () | |
main = mapM_ putStrLn lines | |
where | |
n = 32 :: Int | |
line i = | |
[ if i .&. j /= 0 then ' ' else '*' |
View README.md
To configure this script to automatically execute on file changes, save the XML config in ~/Library/LaunchAgents/dot-files.sync.plist
then do:
launchctl load -w ~/Library/LaunchAgents/dot-files.sync.plist
View Emacs Setup for MacOS.md
Emacs Setup
Installation
My preferred installation on MacOS:
View pyenv-virtualenv.md
First install pyenv.
Afterwards ...
Installing a Python version:
pyenv install 2.7.14
View async-queue.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Callback<A> = (a: A) => void; | |
/** | |
* Delays stuff for ensuring fairness. | |
*/ | |
export function yieldRunLoop(): Promise<void> { | |
const fn: (cb: (() => void)) => void = typeof setImmediate !== 'undefined' | |
? setImmediate | |
: cb => setTimeout(cb, 0) | |
return new Promise(fn) |
NewerOlder