Skip to content

Instantly share code, notes, and snippets.

View gist:51952a09b6b97f451b7f316416db725b
error[E0603]: struct `PathBuf` is private
--> src/bin/evaluate.rs:213:13
|
213 | use std::fs::PathBuf;
| ^^^^^^^^^^^^^^^^
@maurer
maurer / playground.rs
Created Feb 19, 2018 — forked from anonymous/playground.rs
Rust code shared from the playground
View playground.rs
/// Retrieve a list of new files to be copied to the DMS.
pub fn added_files<'a>(local: &'a BTreeSet<LibraryFile>, dms: &'a BTreeSet<LibraryFile>) ->
Vec<&'a LibraryFile> {
local.difference(dms).collect()
}
/// Retrieve a list of new files to be copied to the DMS.
pub fn added_files<'a>(local: &'a BTreeSet<LibraryFile>, dms: &'a BTreeSet<LibraryFile>) ->
Box<Iterator<Item=&'a LibraryFile>> {
Box::new(local.difference(dms)) as Box<Iterator<Item=&'a LibraryFile>>
View gist:d6e9dcd127c3c122bcc8079cff0d1ee5
{
name: 'Ancestral Hourglass',
id: 281,
fixed: function(save) {
return save.reincarnation >= 100;
},
random: function(save) {
var lineageBought = save.fmt36Val;
var lineageLevel = save.lineageLevels[save.lineageFaction - 1];
return ((lineageBought / 3600) ^ (1 - 0.01 * ((lineageLevel ^ 1.01) - save.reincarnation / 5)) / 10) / 100
@maurer
maurer / LatestIndex.hs
Last active Sep 22, 2017
Generating an index.html from latest blog post
View LatestIndex.hs
create ["index.html"] $ do
route idRoute
compile $ do
misnamedItem <- head <$> (recentFirst =<< loadAll "posts/*")
>>= relativizeUrls
return $ misnamedItem {itemIdentifier = "index.html"}
@maurer
maurer / configuration.nix
Created Aug 15, 2016
Setting uid in configuration.nix
View configuration.nix
# snip
users.extraUsers.maurer = {
isNormalUser = true;
uid = 1000;
extraGroups = [ "wheel" "audio" "docker" "vboxusers" ];
};
# snip
View igraph.nix
{stdenv, libxml2, fetchurl}:
stdenv.mkDerivation rec {
name = "igraph";
version = "0.7.1";
buildInputs = [libxml2];
src = fetchurl {
url = "http://igraph.org/nightly/get/c/igraph-0.7.1.tar.gz";
sha256 = "1pxh8sdlirgvbvsw8v65h6prn7hlm45bfsl1yfcgd6rn4w706y6r";
};
View holmes.capnp
@0xaaef86128cdda946;
using Schema = import "schema.capnp";
interface Holmes {
# Capnproto Type Description
using Node = Schema.Node;
# Dynamically typed holmes value (a pointer to anything non interface)
using Val = AnyPointer;
View build.rs
extern crate capnpc;
use std::path::Path;
fn main() {
::capnpc::compile(Path::new("src"),
&[Path::new("src/holmes.capnp"),
Path::new("src/schema.capnp")]).unwrap();
}
View -
[maurer@fragarach:~/Development/PersonalServices/irc]$ gcloud compute zones list
> NAME REGION STATUS NEXT_MAINTENANCE TURNDOWN_DATE
> asia-east1-c asia-east1 UP
> asia-east1-a asia-east1 UP
> asia-east1-b asia-east1 UP
> europe-west1-d europe-west1 UP
> europe-west1-b europe-west1 UP
> europe-west1-c europe-west1 UP
> us-central1-b us-central1 UP
> us-central1-c us-central1 UP
@maurer
maurer / ocamlgraph_bug.ml
Last active Aug 29, 2015
OCamlGraph Inconsistency
View ocamlgraph_bug.ml
open Core_kernel.Std
(* Make a persistent graph where:
A -> B
B -> C
C -> B *)
module G = Graph.Persistent.Digraph.ConcreteBidirectional(String)
let g = List.fold [("A", "B"); ("B", "C"); ("C", "B")] ~f:(fun g (x, y) ->
G.add_edge g x y) ~init:G.empty;;