Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Alexandru Nedelcu alexandru

🏠
Working from home
View GitHub Profile
View buffer-test.scala
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
#!/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
#!/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
#!/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
@alexandru
alexandru / sierpinski.hs
Created Nov 29, 2019
Prints an ASCII Sierpinski triangle
View sierpinski.hs
#!/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

See context.

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 pyenv-virtualenv.md

First install pyenv.

Afterwards ...

Installing a Python version:

pyenv install 2.7.14
View async-queue.ts
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)
You can’t perform that action at this time.