Skip to content

Instantly share code, notes, and snippets.

View 7andrew7's full-sized avatar

Andrew Whitaker 7andrew7

View GitHub Profile
@7andrew7
7andrew7 / list_modified_docs.py
Created July 24, 2024 23:34
List recently modified documents in a MongoDB database
'''List recently modified documents for a given database.
Output lines are of the form: dbName, collectionName, _idValue
'''
import argparse
import sys
import bson
from datetime import datetime, timedelta
@7andrew7
7andrew7 / gist:a70ea3e18f325cf4612b1e763086dc27
Created February 12, 2024 18:56
Crazy wacky asset lake metering pseudocde
@dataclass
class DbEntry:
tenant_id
previousEventTime
pendingEventTime
pendingEventValue
pendingEventIdempotencyKey
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"time"
@7andrew7
7andrew7 / onnx_shape.py
Created February 3, 2023 21:54
onnx shape
#!/usr/bin/env python3
import onnx
import sys
def print1(x):
print (x.name, end=": ")
# get type of input tensor
tensor_type = x.type.tensor_type
#include <iostream>
#include <vector>
int main() {
std::vector<std::string> vec = {"Hello", "Goodbye", "Bonjour", "Au revoir"};
// Option 1: C++11 for each loop. This is the preferred approach in new code.
for (const std::string &s : vec) {
std::cout << s << std::endl;
}
@7andrew7
7andrew7 / gist:4afa3e5c5d890081cdf2
Created February 3, 2015 22:21
tcpdump of localhost http
alias tcpd8000="sudo tcpdump -s 0 -A -i lo0 'tcp port 8000 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'"
@7andrew7
7andrew7 / gist:3fa835542fda59ed7444
Created December 3, 2014 22:51
Simple frequency distribution histogram using matplotlib
#!/usr/bin/env python
"""Compute frequency plot for a given column of a CSV.
./csvfreqdist file col_num
"""
import numpy as np
import matplotlib.pyplot as plt
import os
@7andrew7
7andrew7 / anova.ipynb
Created May 9, 2014 06:36
Andrew's attempt at ANOVA analysis
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@7andrew7
7andrew7 / gist:11016078
Last active August 29, 2015 14:00
hive-site.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<!--
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
@7andrew7
7andrew7 / git_rev.py
Created April 17, 2014 17:42
Determine whether a git repository is "clean" -- i.e., all changes have been committed.
#!/usr/bin/env python
import subprocess
import sys
"""Functionality to query the state of a local git repository."""
def git_clean():
"""Return True if all changes have been committed.