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] = |
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') |
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') |
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 |
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 '*' |
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
My preferred installation on MacOS:
First install pyenv.
Afterwards ...
Installing a Python version:
pyenv install 2.7.14
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