Skip to content

Instantly share code, notes, and snippets.

View yoshuawuyts's full-sized avatar

Yosh yoshuawuyts

View GitHub Profile
//! This module handles the conversion from `Pollable` -> `Future`. We do this
//! by creating an equivalent implementation to the `polling` crate. Once
//! https://github.com/smol-rs/polling/issues/102 has been resolved, this module
//! will likely no longer be needed.
use slab::Slab;
use std::mem;
use wasi::io::poll::{poll, Pollable};
/// Waits for I/O events.
{ config, pkgs, ... }:
let
hostname = "luz3";
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# I use VirtualBox to connect to Windows and Linux guests

Concurrency vs Parallelism, in table form

Concurrency is a system-structuring mechanism, parallelism is a resource. (ref)

There's an important distinction between "parallelism" as a resource, and "parallel execution". The two are often confused, but they are in fact distinct. The key separator is "concurrency":

no parallelism has parallelism
no concurrency sequential execution sequential execution †
has concurrency concurrent execution ‡ parallel execution
// var diffSwap = require('myers-diff-array-swap')
var remove = require('remove-array-items')
var diff = require('myers-diff-array')
var assert = require('assert')
var morphNode = require('./lib/morph')
function Morph () {
this.results = []
this.swaps = []
@yoshuawuyts
yoshuawuyts / lsZshOptions.txt
Created February 6, 2014 23:12
zsh ls options
Mandatory arguments to long options are mandatory for short options too.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
-b, --escape print C-style escapes for nongraphic characters
--block-size=SIZE scale sizes by SIZE before printing them. E.g.,
`--block-size=M' prints sizes in units of
1,048,576 bytes. See SIZE format below.
-B, --ignore-backups do not list implied entries ending with ~
-c with -lt: sort by, and show, ctime (time of last
@yoshuawuyts
yoshuawuyts / wordlist.txt
Created July 9, 2014 18:08
Extracted from Oren Tirosh’s mnemonic encoding project.
Wordlist ver 0.732 - EXPECT INCOMPATIBLE CHANGES;
acrobat africa alaska albert albino album
alcohol alex alpha amadeus amanda amazon
america analog animal antenna antonio apollo
april aroma artist aspirin athlete atlas
banana bandit banjo bikini bingo bonus
camera canada carbon casino catalog cinema
citizen cobra comet compact complex context
credit critic crystal culture david delta
dialog diploma doctor domino dragon drama
#!/bin/sh
#/ Usage: ports [<options>]
#/ Show processes listening on ports.
#/ Any <options> are passed to lsof
set -e
test "$1" = "--help" && {
grep ^#/ <"$0"| cut -c4-
exit 2
}
@yoshuawuyts
yoshuawuyts / Stylus REM mixin
Last active June 2, 2021 17:34
Stylus REM mixin (font-size, line-height).
//define default values (best to put this in the default.styl file)
base-font-size = 16
base-line-height = 24
//This is the useful part: it compares the given value to the base values and calculates the correct output
font-size($fontValue = base-font-size, $baseFontValue = base-font-size, $baseLineValue = base-line-height)
font-size $fontValue px
font-size ($fontValue / $baseFontValue) rem
line-height ($fontValue / $baseFontValue) * $baseLineValue
line-height ($baseLineValue/$baseFontValue) * ($fontValue / $baseFontValue) rem
@yoshuawuyts
yoshuawuyts / Q&A.md
Created March 16, 2016 05:58 — forked from novaluke/0-Q&A.md
I want to use Nix for development, but... -- answers to common concerns about Nix

Nix seems perfect for developers - until I try to use it...

Want to use Nix for development but you're not sure how? Concerned about the fluidity of nixpkgs channels or not being able to easily install arbitrary package versions?

When I first heard about Nix it seemed like the perfect tool for a developer. When I tried to actually use it for developing and deploying web apps, though, the pieces just didn't seem to add up.