Skip to content

Instantly share code, notes, and snippets.

View dgrahn's full-sized avatar

Dan Grahn dgrahn

View GitHub Profile
@dgrahn
dgrahn / nfpa-704 explainer.svg
Created March 3, 2022 15:27
NFPA 704 Explainer (Open Source / Free as in Beer)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dgrahn
dgrahn / token_freqs.csv
Created July 21, 2021 19:34
C/C++ Token Frequencies
token freq
0 Identifier 0.28975789809994656
1 , 0.11085500513657347
2 IntegerLiteral 0.07681658334963642
3 ( 0.07371915527596774
4 ) 0.07371346442857962
5 ; 0.07120506446978692
6 = 0.03211986303113621
7 -> 0.029400075358314605
8 { 0.02097414346886977
@dgrahn
dgrahn / pallete.ts
Created July 24, 2020 16:00
More Colors for Tensorboard
/* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@dgrahn
dgrahn / max_metrics.py
Created June 26, 2020 12:16
Callback to report max of a metric for the Tensorboard HParams plugin
import numpy as np
import tensorflow as tf
from collections import defaultdict
class MaxMetrics(tf.keras.callbacks.Callback):
"""Adds the max metric to the logs at the end of each epoch."""
def __init__(self, metrics):
"""Creates a new MaxMetrics callback
@dgrahn
dgrahn / full-mnist-single-image.ipynb
Last active February 3, 2020 15:30
Full MNIST Single Image.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
0x42232b: mov qword ptr [rsp + 0x48], rcx
0x422330: pcmpeqd xmm1, xmm1
0x422334: movq xmm0, qword ptr [rsp + 0x48]
0x42233a: mov qword ptr [rsp + 0x48], rdi
0x42233f: movhps xmm0, qword ptr [rsp + 0x48]
0x422344: mov dword ptr [rsp + 0x60], r11d
0x422349: mov dword ptr [rsp + 0x58], r10d
0x42234e: mov byte ptr [rsp + 0x120], r9b
0x422356: mov r10, qword ptr [r13 + 0x470]
0x42235d: mov rcx, rax
@dgrahn
dgrahn / keras_metrics.py
Created October 25, 2018 11:24
Metrics removed from Keras in 2.0.
"""Keras 1.0 metrics.
This file contains the precision, recall, and f1_score metrics which were
removed from Keras by commit: a56b1a55182acf061b1eb2e2c86b48193a0e88f7
"""
from keras import backend as K
def precision(y_true, y_pred):
"""Precision metric.
#!/bin/bash
# This is just everything in compile.md
# turned into a script
# you should be able to run it, type in
# sudo passwd and have it install all of panda.
# Verified that this script works
# from a clean install of deb7.
#
#
@dgrahn
dgrahn / NestedAttributesToJSON
Created April 19, 2018 12:34
NiFi Attributes to JSON with Support for JSON Attributes
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
* file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
#!/bin/bash
# Install the latest Google Cloud SDK version - https://cloud.google.com/sdk
#
# To run this script on Codeship, add the following
# command to your project's setup commands:
# source /dev/stdin <<< "$(curl -sSL https://raw.githubusercontent.com/codeship/scripts/master/packages/google-cloud-sdk.sh)"
#
# Add the following environment variables to your project configuration
# * GOOGLE_CLOUD_KEY
# * GOOGLE_CLOUD_PROJECT_ID