Skip to content

Instantly share code, notes, and snippets.

View matjam's full-sized avatar

Nathan Ollerenshaw matjam

View GitHub Profile
@matjam
matjam / gist:ffd408cbb0bf89905018c9554918fffa
Last active March 29, 2024 22:09
env vars for hyprland
#!/usr/bin/bash
export XCURSOR_SIZE=24
export QT_QPA_PLATFORMTHEME=qt5ct # change to qt6ct if you have that
export ELECTRON_OZONE_PLATFORM_HINT=auto
export GDK_BACKEND=wayland,x11
export SDL_VIDEODRIVER=wayland
export CLUTTER_BACKEND=wayland
export MOZ_ENABLE_WAYLAND=1
export MOZ_DISABLE_RDD_SANDBOX=1
glyphBit(const FT_GlyphSlot &glyph, const int x, const int y)
{
int pitch = abs(glyph->bitmap.pitch);
unsigned char *row = &glyph->bitmap.buffer[pitch * y];
char cValue = row[x >> 3];
return (cValue & (128 >> (x & 7))) != 0;
}
// When update() is called, we scan through each character and look in the m_glyph_images map
struct Quad {
sf::Vertex &a;
sf::Vertex &b;
sf::Vertex &c;
sf::Vertex &d;
};
inline Quad &
getQuadForScreenLocation(sf::Vector2i location)
{
inline bool
glyphBit(const FT_GlyphSlot &glyph, const int x, const int y)
{
int pitch = abs(glyph->bitmap.pitch);
unsigned char *row = &glyph->bitmap.buffer[pitch * y];
char cValue = row[x >> 3];
return (cValue & (128 >> (x & 7))) != 0;
}
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"${vcpkgRoot}/x64-windows/include",
"${vcpkgRoot}/x64-windows-static/include",
"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.26.28801/include"
],
fn compileShader(file: var, shader_type: c_uint) !c.GLuint {
std.debug.warn("shader loading file: {}\n", .{file});
const source = try std.fs.cwd().readFileAlloc(std.heap.c_allocator, file, 1000000);
defer std.heap.c_allocator.free(source);
var shader = c.glCreateShader(shader_type);
c.glShaderSource(shader, 1, &(&source[0]), null);
c.glCompileShader(shader);
// check for shader compile errors
const std = @import("std");
const c = @import("c.zig");
const vertexShaderSource =
\\#version 330 core
\\layout (location = 0) in vec3 aPos;
\\void main()
\\{
\\ gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);
\\}
# CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
# install vcpkg into /usr/local/vcpkg or some other path; you just need to point to it.
# hardcode the path in the CMakeLists.txt because I'm a peasant.
set(CMAKE_TOOLCHAIN_FILE "/usr/local/vcpkg/scripts/buildsystems/vcpkg.cmake")
project(testapp
VERSION 0.1
DESCRIPTION "test"
#include <random>
#include <iostream>
#define BUCKETS 100
#define ITERATIONS 100000
int main()
{
uint64_t buckets[BUCKETS] = {0};
std::mt19937_64 rand(1);
@matjam
matjam / model.go
Created October 8, 2019 19:13
Example GORM model
package model
import (
"github.com/jinzhu/gorm"
_ "github.com/jinzhu/gorm/dialects/mysql"
)
// this is shared by all goroutines accessing the database. Note it is NOT
// exported as any database access code should be in this package. This creates
// clean separation of concerns.