Skip to content

Instantly share code, notes, and snippets.

View rcook's full-sized avatar

Richard Cook rcook

View GitHub Profile
@rcook
rcook / LICENSE
Last active March 30, 2020 05:49
Boilerplate for Rust error/result
The MIT License (MIT)
Copyright (c) 2020 Richard Cook
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@rcook
rcook / LICENSE
Last active October 7, 2021 17:40
Bracket pattern in Rust
The MIT License (MIT)
Copyright (c) 2020 Richard Cook
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@rcook
rcook / LICENSE
Last active March 30, 2020 05:48
Parsing MSBuild project XML in Rust
The MIT License (MIT)
Copyright (c) 2020 Richard Cook
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@rcook
rcook / LICENSE
Last active March 28, 2021 17:38
Traits and polymorphism in Rust
The MIT License (MIT)
Copyright (c) 2020 Richard Cook
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@rcook
rcook / LICENSE
Last active February 9, 2021 15:59
Example of a serializable exception in C#
The MIT License (MIT)
Copyright (c) 2020 Richard Cook
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@rcook
rcook / .gitignore
Last active September 23, 2021 18:46
Equality in C#
*.exe
@rcook
rcook / Main.java
Last active December 23, 2019 16:40
Flattening iterator in Java
package org.rcook;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Stack;
import java.util.stream.Stream;
import static java.util.Arrays.asList;
@rcook
rcook / scan.py
Created November 18, 2019 19:05
MP4/QuickTime metadata
import datetime
import exiftool
import os
import shutil
import time
class Metadata(object):
@property
def path(self):
return self._path
@rcook
rcook / Futures.java
Created July 24, 2019 07:32
ListenableFutures again
package org.rcook;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
@rcook
rcook / LICENSE
Last active March 30, 2020 05:48
Exception rethrowing and finally clauses
The MIT License (MIT)
Copyright (c) 2019 Richard Cook
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions: