Skip to content

Instantly share code, notes, and snippets.

View jarcode-foss's full-sized avatar

Levi Webb jarcode-foss

  • Canada, BC
View GitHub Profile
/* center radius (pixels) */
#define C_RADIUS 128
/* center line thickness (pixels) */
#define C_LINE 1
/* outline color */
#define OUTLINE vec4(0.30, 0.30, 0.30, 1)
/* number of bars (use even values for best results) */
#define NBARS 140
fn foo<T: Sized>() {
const foo: usize = mem::size_of::<T>() * 4;
}
fn bar<T: Sized>() {
let foo: usize = mem::size_of::<T>() * 4;
}
@jarcode-foss
jarcode-foss / painter.c
Created August 1, 2018 04:05
Desktop window
void
create_xlib_window(painter_t *painter)
{
painter->_display = XOpenDisplay(config.output_display);
if (!painter->_display) {
fprintf(stderr, "Unable to open display: '%s'\n", XDisplayName(config.output_display));
exit(EXIT_FAILURE);
}
int screen = DefaultScreen(painter->_display);
#!/usr/bin/env python3
import os
import sys
import json
import stat
import logging
import libvirt
from io import StringIO
from pathlib import Path
/*
Lightmap fragment shader
Lighting is calculated per-fragment, and checks for collisions with boxes
provided to this shader in real-time (allowing for accurate, dynamic lights).
This shader is ran once for each light, which is blended per-component (max)
with other lights.
The final lightmap is later smoothed in the processing shader.
@jarcode-foss
jarcode-foss / print.lua
Created September 10, 2019 07:53
overload print in awesome client
function print(text, timeout)
naughty.notify {
preset = naughty.config.presets.normal,
text = text,
border_width = 0,
timeout = timeout or 3,
position = "top_left"
}
end
@jarcode-foss
jarcode-foss / bmp_icon.c
Created December 15, 2019 16:48
Assign _NET_WM_ICON cardinal and XWMHints pixmap for X11 window icons
/* BMP Image header */
struct __attribute__((packed)) bmp_header {
uint16_t header;
uint32_t size;
uint16_t reserved0, reserved1;
uint32_t offset;
/* BITMAPINFOHEADER */
uint32_t header_size, width, height;
uint16_t planes, bits_per_pixel;
uint32_t compression, image_size, hres, vres, colors, colors_used;
@jarcode-foss
jarcode-foss / test_valgrind_cmpxchg.c
Created July 7, 2022 06:42
Demonstrate valgrind false positive for "Conditional jump or move depends on uninitialised value(s)"
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
static int foo = 42;
#define _arch_load(addr, memorder) \
({ \
__auto_type _addr = addr; \
typeof(*_addr) _store; \
@jarcode-foss
jarcode-foss / exception.c
Created July 10, 2022 14:03
exception.c
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include <luabase.h>
#include <ct.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <assert.h>
#include "luajit-2.1/luajit.h"
#include "luajit-2.1/luaconf.h"
#include "luajit-2.1/lua.h"