Skip to content

Instantly share code, notes, and snippets.

View karlbohlmark's full-sized avatar

Karl Böhlmark karlbohlmark

  • Radiant Bits AB
  • Stockholm, Sweden
View GitHub Profile
@karlbohlmark
karlbohlmark / multishot-recv.zig
Created March 2, 2024 21:16
Zig io_uring multishot recv
const std = @import("std");
const os = std.os;
const socket_t = std.os.socket_t;
const io_uring = std.os.linux.IO_Uring;
const Allocator = std.mem.Allocator;
const fs = std.fs;
pub fn main() !void {
const MAX_BUFFERS = 10;
// 1: Använda konstruktorer
function Pitcher () {
// Maps playoutStreamId into a key for outputStats
this.outputs = {};
// Statistics for outputs. Indexed by "<playerId>-<channelId>"
this.outputStats = {};
// Start timestamp for streams. Indexed by playoutStreamId
@karlbohlmark
karlbohlmark / gist:6638374
Created September 20, 2013 14:24
IIS module set request header
GLOBAL_NOTIFICATION_STATUS
OnGlobalPreBeginRequest(
IN IPreBeginRequestProvider * pProvider
)
{
IHttpContext* pHttpContext = pProvider->GetHttpContext();
IHttpRequest* pRequest = pHttpContext->GetRequest();
char *szRange = "bytes=300-1000";
HRESULT result = pRequest->SetHeader((PCSTR)"Range", (PCSTR) szRange, (USHORT) strlen(szRange), true /* replace header */);
if (FAILED(result)) {
@karlbohlmark
karlbohlmark / index.html
Created May 25, 2012 15:25 — forked from stepheneb/index.html
D3 Example: zoom, pan, and axis rescale
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>One Graph</title>
<script type="text/javascript" src="http://localhost:8999/d3.v2.js"></script>
<script type="text/javascript" src="simple-graph.js"></script>
<style type="text/css">
body { font: 13px sans-serif; }
rect { fill: #fff; }
var vows = require('vows'),
assert = require('assert'),
EventEmitter = require('events').EventEmitter,
myEventEmitter = new EventEmitter()
var A = function(){}
// Create a Test Suite
vows.describe('Testing and EventEmitter').addBatch({
'when the topic is a regular object':{
//Uppdatering till Parser 2 API av command skriven av Simon Gate, simon@noona.se
CmdUtils.CreateCommand({
names: ["hitta"],
icon: "http://www.hitta.se/favicon.ico",
description: "Sök på hitta.se.",
help: "hitta [NAMN] i [STAD].",
author: {name: "Karl Böhlmark", email: "karl.bohlmark@gmail.com"},
license: "GPL",
arguments: [{role: 'object', nountype: noun_arb_text}],