Skip to content

Instantly share code, notes, and snippets.

View kevinkreiser's full-sized avatar

Kevin Kreiser kevinkreiser

  • osm.org/node/158543009
  • 04:19 (UTC -04:00)
View GitHub Profile
@kevinkreiser
kevinkreiser / logging.hpp
Last active April 17, 2024 13:25
Thread-safe logging singleton c++11
#ifndef __LOGGING_HPP__
#define __LOGGING_HPP__
/*
Test this with something like:
g++ -std=c++11 -x c++ -pthread -DLOGGING_LEVEL_ALL -DTEST_LOGGING logging.hpp -o logging_test
./logging_test
*/
#include <string>
@kevinkreiser
kevinkreiser / filesystem.hpp
Last active March 5, 2024 15:39
a replacement for std::filesystem when its not available to your compiler
#include <functional>
#include <iostream>
#ifdef use_std_filesystem
#include <experimental/filesystem>
namespace filesystem = std::experimental::filesystem;
#else
#include <cstring>
#include <memory>
@kevinkreiser
kevinkreiser / get_cloud_watch_logs.py
Last active October 5, 2023 06:02
A simple python script that uses aws cli to download logs from cloud watch
#!/usr/bin/env python
import sys
import os
import time
import math
import calendar
import threading
import argparse
import boto3
from functools import partial
@kevinkreiser
kevinkreiser / spmc.cpp
Last active October 3, 2022 05:31
Single Producer Multiple Consumer with ZeroMQ/ZMQ/ØMQ Butterfly Pattern
/* install libzmq-dev:
*
* wget http://download.zeromq.org/zeromq-4.1.0-rc1.tar.gz
* tar pxvf zeromq-4.1.0-rc1.tar.gz
* cd zeromq-4.1.0
* ./autogen.sh
* ./configure
* make
* sudo make install
*
@kevinkreiser
kevinkreiser / worker_pool.py
Created August 31, 2017 15:15
Work Queue Thread Pool Example in Python
#!/usr/bin/env python
#this is mostly from:
#http://code.activestate.com/recipes/577187-python-thread-pool/
from Queue import Queue
from threading import Thread, Event
from sys import stdout, stderr
from time import sleep
#include <sstream>
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
// To test performance you can compile with different preprocessor defines:
// g++ -std=c++11 -O2 -D USE_PRINTF string_format.cpp -o using_printf
// g++ -std=c++11 -O2 -D USE_IOSTREAM string_format.cpp -o using_iostream
// g++ -std=c++11 -O2 -D USE_STRING string_format.cpp -o using_string
@kevinkreiser
kevinkreiser / TODO.txt
Last active October 14, 2019 19:17
Configuring Raid with mdadm
need to edit /etd/mdadm/mdadm.conf remove --name from newly created array or do so when using mdadm --create? remove other raids listed there
sudo update-initramfs -u
that way when problem occurs it wont reassign to /dev/md127
http://ubuntuforums.org/showthread.php?t=1764861
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.