Skip to content

Instantly share code, notes, and snippets.

View cjhanks's full-sized avatar
🔥

zeekoni cjhanks

🔥
View GitHub Profile
@cjhanks
cjhanks / ffmpeg_parse.cc
Created March 31, 2012 03:12
ffmpeg parsing
#include <stdio.h>
#include <iostream>
#include <string>
#include <string.h>
/**
* This simple argv parser splits a command like:
* ffmpeg -f libx264 -i input.avi -acodec libmp3lame -ab 128k -ar 44100 -vcodec
* mpeg2video -vf scale=160:128 -b 176k -r 15 -strict -1 -ab output.mpg
*
@cjhanks
cjhanks / analyze-x86
Created January 25, 2015 17:24
Found this,didn't want to lose it
#!/usr/bin/env python3
# coding: utf-8
""" analyze-x86.py
Copyright (C) 2010 Aleksey Frolov <atommixz@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 19 columns, instead of 11. in line 6.
"date","death","deathIncrease","inIcuCumulative","inIcuCurrently","hospitalizedIncrease","hospitalizedCurrently","hospitalizedCumulative","negative","negativeIncrease","onVentilatorCumulative","onVentilatorCurrently","posNeg","positive","positiveIncrease","recovered","states","totalTestResults","totalTestResultsIncrease"
"2020-10-26",217418,389,23542,8842,1838,42917,463529,115457526,981108,2703,2301,0,8660366,62315,3460455,56,133750060,1153040
"2020-10-25",217029,377,23420,8489,1153,41776,461691,114476418,901330,2693,2176,0,8598051,65687,3422934,56,132597020,1123112
"2020-10-24",216652,890,23356,8561,1756,41905,460538,113575088,962036,2691,2230,0,8532364,83015,3406701,56,131473908,1222616
"2020-10-23",215762,917,23221,8237,15005,41482,458782,112613052,1043191,2679,2180,0,8449349,83128,3375480,56,130251292,1286696
"2020-10-22",214845,1143,23018,8086,2571,41010,443777,111569861,913969,2641,2147,0,8366221,75248,3353056,56,128964596,1128940
"2020-10-21",213702,1024,22855,8182,2239,40271,441206,110655892,691316,26
@cjhanks
cjhanks / beat_frequency.py
Created August 5, 2020 16:14
beat_frequencies
from argparse import ArgumentParser
import sys
import math
import matplotlib.pyplot as plt
import numpy as np
# This variable holds the steps for a minor scale
MinorSteps = [
0, # A
@cjhanks
cjhanks / example.cu
Created May 14, 2019 17:47
CuFFT Regression
#include <cmath>
#include <algorithm>
#include <iostream>
#include <complex>
#include <cufft.h>
static constexpr int N1 = 64;
static constexpr int N2 = 512;
#!/usr/bin/env python
#
# Send/receive UDP multicast packets.
# Requires that your OS kernel supports IP multicast.
#
# Usage:
# mcast -s (sender, IPv4)
# mcast -s -6 (sender, IPv6)
# mcast (receivers, IPv4)
# mcast -6 (receivers, IPv6)
@cjhanks
cjhanks / Cascade.cc
Last active February 24, 2018 05:45
Cascading voxel grid.
#include <cmath>
#include <cstdint>
#include <algorithm>
#include <iostream>
#include <unordered_map>
#include <vector>
union SimpleVoxelCell {
SimpleVoxelCell() = default;
@cjhanks
cjhanks / NIM.CmakeLists
Created February 21, 2018 19:26
Beginning attempt at nim and cmakelist.
# vim: ts=2 sw=2 et ai tw=80
CMAKE_MINIMUM_REQUIRED(VERSION 3.9)
FILE(GLOB NIM_SOURCES "*.nim")
ADD_CUSTOM_COMMAND(
OUTPUT
libtest.a
COMMAND
nim c --app:staticlib -o:libtest.a $(SOURCES)
#ifndef ZEN_HDF5_H_
#define ZEN_HDF5_H_
#include <vector>
#include <glog/logging.h>
#include <hdf5.h>
namespace zen {
@cjhanks
cjhanks / queue.cc
Created December 5, 2017 01:31
Blocking Chanel
#include "queue.h"
#include <iostream>
std::size_t
BlockingPipe::Read(std::uint8_t* data, std::size_t length)
{
std::size_t rc = length;
while (length > 0) {