Skip to content

Instantly share code, notes, and snippets.

View ranjian0's full-sized avatar
🎯
Focusing

Ian Karanja ranjian0

🎯
Focusing
  • Nairobi, Kenya
  • 16:19 (UTC +03:00)
View GitHub Profile
const std = @import("std");
const Foo = struct {
const Self = @This();
bar:std.ArrayList(u8) = undefined,
pub fn init(allocator: std.mem.Allocator) Foo {
var bar = std.ArrayList(u8).init(allocator);
return .{ .bar = bar };
}
@ranjian0
ranjian0 / crap.js
Created May 14, 2023 08:17
create a minimal react + parcel project
const { execSync } = require('child_process');
const fs = require('fs');
const path = require('path');
function execCommand(command) {
try {
execSync(command, { stdio: 'inherit' });
} catch (err) {
console.error(`Error executing command: ${command}`);
process.exit(1);
@ranjian0
ranjian0 / gltf_indices_export.py
Created September 12, 2022 00:01
Blender Extract Unique Indices from GLTF export
"""
Blender's GLTF exporter does some splitting of blender verts based on loops i.e in my case a mesh with 386 verts ends up with
441 verts after gltf export.
As explained at https://blender.stackexchange.com/questions/167372/gltf-export-has-twice-the-vertices-it-should
glTF is a last mile format and stores mesh data in a "Ready to load on GPU" state.
This script basically predetermines how the export will split the vertices and produces all the vertex
indices that will exist in the final gltf data.
@ranjian0
ranjian0 / .vimrc
Created February 1, 2022 06:09 — forked from miguelgrinberg/.vimrc
My .vimrc configuration for working in Python with vim
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let need_to_install_plugins = 1
endif
call plug#begin()
Plug 'tpope/vim-sensible'
@ranjian0
ranjian0 / rename apigateway resource
Created December 1, 2021 13:32
aws cli commands to rename apigateway resource
# Find the api id
aws apigateway get-rest-apis
# Find the resource id
aws apigateway get-resources --rest-api-id <api_id>
# Rename the resource
aws apigateway update-resource --rest-api-id <api_id> --resource-id <res_id> --patch-operations op=replace,path=/pathPart,value=<new_name>
@ranjian0
ranjian0 / script_watcher.py
Created June 10, 2020 12:08
ScriptWatcher used with building tools addon.
"""
script_watcher.py: Reload watched script upon changes.
Copyright (C) 2015 Isaac Weaver
Author: Isaac Weaver <wisaac407@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.