Skip to content

Instantly share code, notes, and snippets.

@lu4nm3
lu4nm3 / main.rs
Last active May 6, 2024 12:00
Tokio Async: Concurrent vs Parallel
use futures::StreamExt;
use std::error::Error;
use tokio;
use tokio::macros::support::Pin;
use tokio::prelude::*;
use tokio::time::{Duration, Instant};
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut multi_threaded_runtime = tokio::runtime::Builder::new()
.threaded_scheduler()
function YNABAccounts(accessToken, budgetId) {
const accounts = _getBudgetAccounts(accessToken, budgetId);
if(accounts == null) {
return null;
}
const columns = ["Name", "Type", "Budget", "Closed", "Balance"];
const rows = accounts.map(function (acc) {
return [
@agarrharr
agarrharr / index.md
Last active December 27, 2023 18:18
Common Ledger CLI Commands

Common Ledger CLI Commands

  • Income vs expenses this month?

    $ ledger balance income expenses --period "this month"
  • What did my budget look like at a certain date?

@CMCDragonkai
CMCDragonkai / elixir_and_haskell_unicode.md
Last active August 10, 2021 18:24
Elixir & Haskell: Unicode (UTF8) Support #unicode #elixir #haskell

Elixir & Haskell: Unicode

Most text nowadays is encoded as unicode, and yet some programming languages either don't natively support it, or require you to jump through some hoops to support it. Elixir and Haskell have good support for Unicode, however there are some issues we have to understand, in order to manipulate text well.

Introduction to Text Encodings and Numeral System Bases

@agrafix
agrafix / UTCTimeArbitrary.hs
Created September 12, 2014 23:30
Haskell UTCTime Arbitrary instance
import Data.Time
instance Arbitrary UTCTime where
arbitrary =
do randomDay <- choose (1, 29) :: Gen Int
randomMonth <- choose (1, 12) :: Gen Int
randomYear <- choose (2001, 2002) :: Gen Integer
randomTime <- choose (0, 86401) :: Gen Int
return $ UTCTime (fromGregorian randomYear randomMonth randomDay) (fromIntegral randomTime)
@staltz
staltz / introrx.md
Last active May 22, 2024 13:59
The introduction to Reactive Programming you've been missing
@i-e-b
i-e-b / Readme_NIX_OS.md
Last active July 4, 2023 16:53
/etc/nixos/configuration.nix

My experiments with an XMonad setup in NixOS. This is my work box now, so it pretty much works.

probably needs:

# useradd -m iain
# passwd iain ...
# passwd root ...
@erochest
erochest / generate-html.sh
Created March 21, 2012 17:46
A script I wrote in Literate Haskell using Shelly
#!/bin/sh
# pandoc -f markdown+lhs -t html5 --smart --css https://raw.github.com/richleland/pygments-css/master/default.css s5topdf.lhs
# pandoc -f markdown+lhs -t html5 --smart --css s5topdf.css s5topdf.lhs
pandoc -f markdown+lhs -t html5 --smart s5topdf.lhs