I hereby claim:
- I am milleniumbug on github.
- I am milleniumbug (https://keybase.io/milleniumbug) on keybase.
- I have a public key whose fingerprint is 61BE F024 E95B CDFC FFE0 354A E069 867F CF5D 84EA
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
import collections, csv, itertools | |
recipes = collections.defaultdict(set) | |
tolerance = 0 | |
with open('rec.csv') as csvfile: | |
reader = csv.reader(csvfile) | |
for row in reader: | |
recipes[row[0]].add(row[1]) |
{-# LANGUAGE OverloadedStrings #-} | |
import qualified Data.Aeson as JS | |
import qualified Data.Aeson.Types as JST | |
import Data.Maybe (maybeToList) | |
import Data.Aeson ((.:), (.:?), (.=)) | |
import qualified Data.Text.Lazy as T | |
import Data.Text.Lazy.Encoding as E | |
import qualified Control.Monad as M | |
import qualified Data.JsonStream.Parser as JSPar |
#!/bin/bash | |
PREMAKE=$PWD/../premake/bin/release/premake4 | |
$PREMAKE --llvm-path=$PWD/../llvm gmake | |
cd Wide | |
make -j `nproc` config=release64 | |
cd .. |
Note: PowerShell is object based, as opposed to byte stream based Unix utilities. This means text operations aren't that common, and also means many idioms aren't directly translateable.
var=text
-> $var = object
cat file1 file2 file3 > target
-> gc -Encoding Byte file1,file2,file3 | sc -Encoding Byte target
(binary concatenation, with text files you can specify different encoding or let it guess)curl
-> iwr
(Invoke-WebRequest
)date
-> date
(Get-Date
)man command-name
-> help command-name
(Get-Help
)# /etc/ddclient.conf | |
ssl=yes | |
protocol=dyndns2 | |
use=web | |
web=whatismyip.org | |
server=dyn.dns.he.net | |
login=<your domain name> | |
password='<your API key>' | |
<your domain name> |
#!/bin/bash | |
if [ $# -lt 2 ]; then | |
echo "Usage: passphrasegen.sh path-to-dictionary number-of-words" | |
exit 1 | |
fi | |
# TOFIX: the actual number of possible passwords is not N^M, but N*(N-1)*(N-2)*...*(N-M+1) | |
shuf -n "$2" "$1" --random-source /dev/urandom | paste -d\ --serial |
public static class ObservableCollectionExtensions | |
{ | |
public static IDisposable SuppressCollectionEvents(this INotifyCollectionChanged collection, | |
bool fireEventWhenComplete = true) | |
{ | |
return new CollectionEventSuppressor(collection, fireEventWhenComplete); | |
} | |
private class CollectionEventSuppressor : IDisposable | |
{ |
public class ValueBased<T> : IEquatable<ValueBased<T>> | |
{ | |
private static readonly IReadOnlyList<FieldInfo> fields; | |
static ValueBased() | |
{ | |
fields = typeof(T).GetRuntimeFields().Where(field => !field.IsStatic).ToList(); | |
} | |
/// <inheritdoc /> |
#include <vector> | |
#include <iostream> | |
// nice little class A | |
class A | |
{ | |
B b; | |
int a; | |
std::vector<int> allTheInts; | |
int doThisThing() { return b.stuff() + a; } |