Skip to content

Instantly share code, notes, and snippets.

View erichocean's full-sized avatar

Erich Ocean erichocean

  • Xy Group Ltd
  • North Carolina
View GitHub Profile
@alpha123
alpha123 / ssa-interp.c
Last active April 24, 2023 04:27
Primitive SSA Bytecode Interpreter
#include <stdlib.h>
#include <stdbool.h>
#include <stddef.h>
#define _WITH_GETLINE
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include <inttypes.h>
#include <assert.h>
@risicle
risicle / cache_chained_calculation.py
Created March 17, 2016 16:54
Django cache work-sharing using PostgreSQL advisory locks
from django.core.cache import cache
from django.core.cache.backends.base import DEFAULT_TIMEOUT
from django.db import connection , transaction
from hashlib import md5
def cache_chained_calculation(characteristic_str, calculate_function, timeout=DEFAULT_TIMEOUT, force_update=False):
"""
Attempt to obtain result of @calculate_function, represented by @characteristic_str, through cache or calling the
function. Should only allow one caller to be calculating the value at once (enforced using postgres advisory locks),
@bkaradzic
bkaradzic / orthodoxc++.md
Last active May 14, 2025 23:21
Orthodox C++

Orthodox C++

What is Orthodox C++?

Orthodox C++ (sometimes referred as C+) is minimal subset of C++ that improves C, but avoids all unnecessary things from so called Modern C++. It's exactly opposite of what Modern C++ suppose to be.

Why not Modern C++?

;;;; metal/compiler.lisp
;;;;
;;;; Copyright (c) 2015 Adrian Medina
(in-package :metal)
(defparameter *metal-source-paths*
(asdf:system-relative-pathname *system* "src/metal/"))
(defun metal (pathname)
@egze
egze / buildMobileVLCKit.sh
Last active January 6, 2018 16:31
Build TVVLCKit.framework with buildMobileVLCKit.sh -t
#!/bin/sh
# Copyright (C) Pierre d'Herbemont, 2010
# Copyright (C) Felix Paul Kühne, 2012-2015
set -e
BUILD_DEVICE=yes
BUILD_SIMULATOR=yes
BUILD_STATIC_FRAMEWORK=no
BUILD_STATIC_FRAMEWORK_TV=no
;; setup db to test with
;; note that this setup uses a local dev transactor
;; you can use a different transactor, but you cannot
;; use a mem db because it does not support the log API
(require '[datomic.api :as d])
(def uri "datomic:dev://localhost:4334/reified-txes")
(d/delete-database uri)
(d/create-database uri)
(def conn (d/connect uri))
// ImGui - standalone example application for Glfw + OpenGL 3, using programmable pipeline
#include <imgui.h>
#include "imgui_impl_glfw_gl3.h"
#include <stdio.h>
#include <GL/gl3w.h>
#include <GLFW/glfw3.h>
#include <math.h>
#include <string.h>
#include <vector>
@ocornut
ocornut / imgui_node_graph_test.cpp
Last active March 6, 2025 16:51
Node graph editor basic demo for ImGui
// Creating a node graph editor for Dear ImGui
// Quick sample, not production code!
// This is quick demo I crafted in a few hours in 2015 showcasing how to use Dear ImGui to create custom stuff,
// which ended up feeding a thread full of better experiments.
// See https://github.com/ocornut/imgui/issues/306 for details
// Fast forward to 2023, see e.g. https://github.com/ocornut/imgui/wiki/Useful-Extensions#node-editors
// Changelog
// - v0.05 (2023-03): fixed for renamed api: AddBezierCurve()->AddBezierCubic().
@thlorenz
thlorenz / update_to_nan_v2.0.x.sh
Last active October 13, 2016 08:04
Script to update Node.js addons to work with nan 2.0.x and thus with iojs v3.x (gets you 90% there)
#!/bin/bash
replacements=(
"NanAsyncWorker/Nan::AsyncWorker"
"NanAsyncQueueWorker/Nan::AsyncQueueWorker"
"NanCallback/Nan::Callback"
"NanSetInternalFieldPointer/Nan::SetInternalFieldPointer"
"NanGetInternalFieldPointer/Nan::GetInternalFieldPointer"
"NanNewBufferHandle\\(([^;]+);/Nan::NewBuffer(\\1.ToLocalChecked();"
"(NanNew(<(v8::)?String>)?\\(\"[^\"]*\"\\))/\\1.ToLocalChecked()"
@laxika
laxika / gist:7170b33a2c456e6d3927
Last active May 3, 2017 03:46
Vultr CoreOS cloud-config.yaml
#!/bin/bash
V4_PRIVATE_IP=`curl http://169.254.169.254/current/meta-data/local-ipv4`
V4_PUBLIC_IP=`curl http://169.254.169.254/current/meta-data/public-ipv4`
cat > "cloud-config.yaml" <<EOF
#cloud-config
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEApv0BQSB1G1TsjKsvzREQfOjv0d+a8hHojk0oJ5B/Aue7Swp0rUN8JViAd91OSGUdAkwy3A/hJ4PoumnwrQlQTGK+JZto7kWONsPSzaBe0SJldOFXdJdiY71ZsT/CIsZgosA2dzDYuUZlo3i9FWTlmg71bJu2JnHq5Z5cWXLV7syPXLvIDcrOzCwUOHWxolYWFUdQPY6w44eg6VhYq+Q3V9Q1NCls0OuLe+k/AjsE6udoFmJai3RHnEVZPNiZz+jKtZXgbsPbH8BSlc1LauRXJBviKU9WF1OXot0FTfRP2H958R9fKvCS5kIOACtFGZUISnYHGH85nnpTNkILICsSlw==
write_files: