Skip to content

Instantly share code, notes, and snippets.

View howarddierking's full-sized avatar

Howard Dierking howarddierking

View GitHub Profile
{
"@context": {
"@vocab": "https://schema.acme.com/",
"@base": "https://graph.acme.com/"
}
}
@howarddierking
howarddierking / main.rs
Last active September 16, 2021 00:49
sorting causes move
fn report_adjacency_list(g: HashMap<u32, Vec<u32>>){
// need to sort
let sorted_keys = g.keys().sorted();
println!("{}\t# number of vertices", g.len());
let mut last_line = 1 + sorted_keys.len();
for (i, k) in sorted_keys.enumerate() {
let val = g.get(k).unwrap();
{
"@context": {
"@vocab":"http://example.com/blogpost#"
},
"title": "foo",
"authorName": "howard",
"contentMd": "bar",
"createdAt":"2021-08-27"
}
#
# Scenarios
# 1. see the change history for an entity
# 2. refer to the entity in a non-versioned manner for ease of access
# 3. manage the size of the graph (e.g. reduce data duplication where possible)
# 3.a. for literals
# 3.b. for references to other entities
# Notes
# - any change operation on an entity MUST update the respective EntityHead for the entity with the pointer to the latest EntityVersion (this should be the only mutation)
# - another notable difference between git and this exploration is that the unit of immutabilty in git is a blob (a file) and the state of the repository is the state of the tree pointed to by the commit - TODO: is the tree a snap of *all* versioned blobs? If so, perhaps the only real difference here is that this application includes literals, which could increase the storage footprint of a tree analog.
'use strict';
const R = require('ramda');
const Rx = require('../ramdaExt');
const concatUnique = (k, l, r) => {
if(R.equals(l, r))
return R.flatten([l]);
return R.flatten([l, r]);
}
// This succesfully merges the supplied object with the state object
function builder(){
let state = {};
return {
options: function (){
state = mergeFragment('opts', state, optionsFragment(...arguments));
},
product: function(){
return state;
}
@howarddierking
howarddierking / howWeTech.js
Created April 17, 2018 16:13
How we tech
function HowWeTech(someTech){
declare(`${someTech} is awesome - let's use it!!!`);
warn(`but it's possible to abuse ${someTech}`);
abuse(someTech);
blame(someTech, `it was able to be abused!!`);
let ourTech = createLesser(someTech);
try {
use(ourTech);
} catch (e) {
declare(`hey, have you seen ${someNewTech}??`);
@howarddierking
howarddierking / CsvShredder.java
Created December 6, 2017 17:20
Sample ParDo transformation for shredding CSV files into a map
package com.howarddierking.demo;
import org.apache.beam.sdk.io.FileSystems;
import org.apache.beam.sdk.io.fs.ResourceId;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVParser;
import org.apache.commons.csv.CSVRecord;
import org.apache.commons.io.FilenameUtils;
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix schema: <https://schema.org/> .
@prefix ex: <http://foo.com/1.0/> .
ex:howard_dierking schema:givenName "Howard" .
ex:triple123 rdf:type rdf:Statement .
ex:triple123 rdf:subject ex:howard_dierking .
ex:triple123 rdf:predicate schema:givenName .
ex:triple123 rdf:object "Howard" .
ex:triple123 schema:dateModified "2016-12-07" .
@howarddierking
howarddierking / dumpContainer.sh
Last active January 17, 2016 10:28
Dump Azure blob storage container using CLI
azure storage blob list -c "<Connection String>" --container "<Blob Container>" | \
awk '{print $2}' | head -n -1 | tail -n +5 | xargs -P <Desired Parallelism> -I {} \
azure storage blob download -c "<Connection String>" --container "<Blob Container>" -b {} -d .