Skip to content

Instantly share code, notes, and snippets.

View dlwhitehurst's full-sized avatar

David L. Whitehurst dlwhitehurst

View GitHub Profile
@dlwhitehurst
dlwhitehurst / .bash_profile
Created September 8, 2017 14:35 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
fn main() {
// initial hashes a, b, c, d, e, f, g, h
let a:u32 = 0x6A09E667;
let b:u32 = 0xBB67AE85;
let c:u32 = 0x3C6EF372;
let d:u32 = 0xA54FF53A;
let e:u32 = 0x510E527F;
@dlwhitehurst
dlwhitehurst / gist:6aff1dc85205315e59d5b60e702681b2
Created May 31, 2018 18:44
Convert unsigned char array to string
#define bufferSize 10
int main() {
unsigned char buffer[bufferSize]={1,2,3,4,5,6,7,8,9,10};
char converted[bufferSize*2 + 1];
int i;
for(i=0;i<bufferSize;i++) {
sprintf(&converted[i*2], "%02X", buffer[i]);
/* equivalent using snprintf, notice len field keeps reducing

Keybase proof

I hereby claim:

  • I am dlwhitehurst on github.
  • I am dlwhitehurst (https://keybase.io/dlwhitehurst) on keybase.
  • I have a public key ASATkvn72QGEF0GPNX-S6WQXukfHwmTYNDmNNSEDL0D0Zgo

To claim this, I am signing this object:

/**
*
* VirtualYou.io
*
* Copyright 2019 CI Wise Inc.
*
* 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
*
%dw 1.0
%output application/json
%var idToFieldName = {
"5324": "firstName",
"5325": "lastName",
...
}
---
payload.elements[0].fieldValues reduce (field, entity={}) ->

Keybase proof

I hereby claim:

  • I am dlwhitehurst on github.
  • I am virtualme (https://keybase.io/virtualme) on keybase.
  • I have a public key ASBrBSoS6CuMsWLIeXkf7EMTKZgNKcYkkQYz6Ny6HCVK_go

To claim this, I am signing this object:

@dlwhitehurst
dlwhitehurst / column-sum-special.md
Last active March 31, 2020 17:42
Sum Grouped Column Values after Sort

Overview

Sometimes we need to combine values and de-dupe specific columns. Here's an example:

       A      B      C
1     foo    12    California
2     foo    22    California
3     bar    8     Rhode Island
4     bar    32    Rhode Island
5     baz    15    Ohio

6 baz 26 Ohio