Skip to content

Instantly share code, notes, and snippets.

View dsheeler's full-sized avatar

Daniel Sheeler dsheeler

View GitHub Profile
@nickbailey
nickbailey / thread_pool-test.cpp
Last active October 24, 2018 08:32
ThreadPool: Use all your cores
/*
* Test the thread_pool class
*
* Compile with g++ -I.. ../thread_pool.cpp thread_pool-test.cpp -pthread
*/
#include <iostream>
#include <mutex>
#include <exception>
#include "thread_pool.h"
@callahanrts
callahanrts / github.vim
Last active November 25, 2021 09:14
Vim command to open a browser tab at the selected line of any git project.
function! ShowOnGithub()
let u = system("echo ${${${$(git --git-dir=.git config --get remote.origin.url)#[email protected]:}%.git}#https://github.com/} | xargs echo -n")
silent exec "!open "."https://github.com/".u."/blob/master/".@%.'\#L'.line(".")
endfunction
command! -nargs=0 ShowOnGithub call ShowOnGithub()
nnoremap <Leader>gh :ShowOnGithub<CR>

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns                     on recent CPU
L2 cache reference ........................... 7 ns                     14x L1 cache
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns                     20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs 4X memory

@oneman
oneman / gist:6148451
Created August 3, 2013 23:55
RCU Fun List
Macro Player - Simplest would be insert a series of commands into a textarea
Macro Recorder - Records all API commands sent for later replay
Adapters Browser - Lets you see all available adapters and capability such as V4L2/Jack/Decklink etc
Station Info - Lets you see system load/uptime/stats/etc
Screenshot Grabber
Radical Revelations :: The Krad Radio Web Development Field Guide
-----------------------------------------------------------------
Hello and welcome to the hilarious adventure of of Krad Radio Web Development!
Lets get started. This brief guide will be all you need to begin developing
user interfaces and automated control systems for the Krad Radio interweb media
server using familar web 1.0 - 4.0 technologies such as HTTP, Javascipt/JSON,
WebSockets and WebRTC.
If you would like to build your own system from scratch you can connect to the
#!/usr/bin/env ruby
governors = ["performance", "ondemand"]
def setgov(gov, thread)
`echo #{gov} > /sys/devices/system/cpu/cpu#{thread}/cpufreq/scaling_governor`
end
def showgov(thread)
gov = `cat /sys/devices/system/cpu/cpu#{thread}/cpufreq/scaling_governor`.chomp
anonymous
anonymous / gist:4974045
Created February 17, 2013 23:19
==Notes from Feb 17 2013 Review==
Compositor:
Fix Res/FPS setting
EBML:
Decouple MKV/WebM Muxing/Demuxing from EBML r/w
Legacy:
Fix dylib location issue
#include "kr_client.h"
int main (int argc, char *argv[]) {
kr_client_t *client;
char *sysname;
sysname = NULL;
client = NULL;
#!/usr/bin/env ruby
# Hello Krad World Video
require "/home/oneman/kode/krad_radio/scripts/kradradio_client.rb"
# Station name
station_name = "testsignal"
# Video resolution and frame rate
diff --git a/lib/krad_compositor/krad_compositor.c b/lib/krad_compositor/krad_compositor.c
index f20d580..ed47844 100644
--- a/lib/krad_compositor/krad_compositor.c
+++ b/lib/krad_compositor/krad_compositor.c
@@ -139,7 +139,7 @@ void krad_compositor_add_text (krad_compositor_t *krad_compositor, char *text, i
krad_text = NULL;
- for (s = 0; s < KRAD_COMPOSITOR_MAX_TEXTS; s++) {
+ for (s = 0; s < KC_MAX_TEXTS; s++) {