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
data RiskTier = Widespread | Substantial | Moderate | Minimal | |
deriving (Show, Eq) | |
instance Ord RiskTier where | |
compare x y = compare (tierNumber x) (tierNumber y) | |
where | |
tierNumber t = case t of | |
Widespread -> 1 | |
Substantial -> 2 | |
Moderate -> 3 |
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 python3 | |
import secrets | |
entropy_bytes = 16 | |
print(secrets.token_urlsafe(entropy_bytes)) |
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
#include <utility> | |
class my_class { | |
public: | |
compl my_class() {} // Destructor | |
}; | |
int main() { | |
my_class example_obj; | |
my_class bitand example_ref = example_obj; |
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
#include <unistd.h> | |
#include <pwd.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stddef.h> | |
/** | |
* @file | |
* Utility function to start a shell based on reasonable inferences | |
*/ |
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
#!/bin/sh | |
# To integrate, place the following into your .gitconfig: | |
# [alias] | |
# sct = !path/to/git-sct.sh | |
if [ $# -lt 1 ]; then | |
echo "Usage: git sct <revision> [<parent-number>]" | |
exit 1 | |
fi |
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 Data.Char (toUpper) | |
import Data.List (intercalate) | |
import Data.List.NonEmpty (NonEmpty, nonEmpty, toList) | |
import System.Environment (getArgs) | |
data PangramResult = Pangram | MissingLetters (NonEmpty Char) | |
checkPangram :: String -> PangramResult | |
checkPangram s = case nonEmpty missingLetters of | |
Just ls -> MissingLetters ls |
NewerOlder