Skip to content

Instantly share code, notes, and snippets.

  1. Deploy ACS to the cluster
  2. Create a new nasmespace to test the workloads
kubectl create ns test
  1. Create a server with restrictive network policy (e.g. block all traffic)
apiVersion: apps/v1
kind: Deployment
metadata:
void oscillator_callback(void *userdata, Uint8 *stream, int len) {
float *fstream = (float *)stream;
for (int i = 0; i < BUFFER_SIZE; i++) {
float v = next(A4_oscillator);
fstream[i] = v;
}
}
typedef struct {
float current_step;
float step_size;
float volume;
} oscillator;
oscillator oscillate(float rate, float volume) {
oscillator o = {
.current_step = 0,
.volume = volume,
const int SAMPLE_RATE = 44100;
const int BUFFER_SIZE = 4096;
void callback(void *userdata, Uint8 *stream, int len) {
for (int i = 0; i < len; i++) {
stream[i] = /* ADD SAMPLE HERE */ ;
}
}
int main() {
@fredrb
fredrb / main.c
Created August 8, 2023 12:47
Playing A4 with SDL
#include "SDL2/SDL_audio.h"
#include "SDL2/SDL_timer.h"
#include <SDL2/SDL.h>
#include <errno.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
const int SAMPLE_RATE = 44100;
const int BUFFER_SIZE = 4096;
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
type Assertion interface {
// ... redacted for brevity
}
func With(t *testing.T) Assertion {
return &assertImpl{wrappedT: t}
}
type assertImpl struct {
wrappedT *testing.T
func Test_CheckValuesAreSame(t *testing.T) {
assert.With(t).Equal("a", "b") // assertion fails but tests continue
assert.With(t).Must().Equal("a", "b") // assertion fails and test stops
panic("This panic shouldn't happen")
}
func Test_FormatTesting(t *testing.T) {
assert.With(t).Messagef("%s should be equal %s", "a", "b").
Equal("a", "b")
func (f *testFunc) Qualifier(p *types.Package) string
func (f *testFunc) Params() string
func (f *testFunc) ForwardedParams() string
func (f *testFunc) ParamsFormat() string
func (f *testFunc) ForwardedParamsFormat() string
func (f *testFunc) Comment() string
func (f *testFunc) CommentFormat() string
func (f *testFunc) CommentWithoutT(receiver string) string
type testFunc struct {
CurrentPkg string
DocInfo *doc.Func
TypeInfo *types.Func
}