Skip to content

Instantly share code, notes, and snippets.

View jealouscloud's full-sized avatar

Noah makes software jealouscloud

View GitHub Profile
@jealouscloud
jealouscloud / README.md
Created January 7, 2023 14:12
Command line json generator

Simple tool to produce json from shell args

This is useful to put someplace in your PATH (possibly ~/bin or /usr/local/bin/) with a cute name and use with curl.

I simply call it "json".

Example:

[noaha@vbo-t3x-pro-nax: ~]$ payload="$(json "body=test body" "title=Test title" props="$(json monday_broadcast=True)")"
[noaha@vbo-t3x-pro-nax: ~]$ echo "$payload" | jq # pretty print
@jealouscloud
jealouscloud / wm.lua
Created September 15, 2021 00:36
Docking / undocking management code for awesomewm clients
local tag_store = {} -- ["output"]["tag"][client]
-- Handle screen undocking / docking
tag.connect_signal("request::screen", function(t)
local fallback_tag = nil
-- find tag with same name on any other screen
for other_screen in screen do
if other_screen ~= t.screen then
fallback_tag = awful.tag.find_by_name(other_screen, t.name)
@jealouscloud
jealouscloud / branchless.glsl
Created June 7, 2018 23:21
branchless frag shader
#version 120
uniform float u_scale;
uniform int u_knobstate;
uniform bool u_alphachannel;
uniform vec4 u_knobcolor;
//basically u/v coordinates to the circle.
varying vec2 v_circle;
varying vec2 v_linesize;
varying vec4 v_color;
varying float v_selectflags;
#version 120
uniform float u_scale;
uniform int u_knobstate;
uniform bool u_alphachannel;
uniform vec4 u_knobcolor;
//basically u/v coordinates to the circle.
varying vec2 v_circle;
varying vec2 v_linesize;
varying vec4 v_color;
varying float v_selectflags;
@jealouscloud
jealouscloud / README.md
Last active May 11, 2018 21:05
haxe performance analysis

Foreword

I have not used haxe extensively. I do not claim to know what is going through the heads of the developers of haxe. This is my personal analysis and it very well could be false.

Concept

I created a small application to parse a ~1mb file and create substrings for each space in the file. The variables are designated static as part of the design i noticed in the haxe compiler. Pleasantly, I was surprised to find Main_obj::__SetStatic in the transpiled source was not used. Ideally, it's only there for reflection.

All sources were compiled with the release configuration targeting 64 bits.

Results

  • Haxe C++: 25ms
@jealouscloud
jealouscloud / JSONLoader.cs
Created February 19, 2018 02:48
json reader
using OpenTK;
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using Utf8Json;
using System.Diagnostics;
using linerider.Lines;
using linerider.IO.json;