Skip to content

Instantly share code, notes, and snippets.

View vinjn's full-sized avatar

Jing Zhang vinjn

View GitHub Profile
@capntrips
capntrips / Inject.cpp
Last active October 11, 2021 10:46 — forked from robert-nix/Inject.cpp
Unity 2017.1.2p4 type information
// A quick and dirty DLL injector
// This method relies on static linkage and the fact that kernel32 doesn't move
// Compile with the same bitness as the target and the dll.
#define WIN32_LEAN_AND_MEAN
#include <Windows.h>
#include <Psapi.h>
#include <stdio.h>
int GetPid(char *modName)
{
@kylehounslow
kylehounslow / client.py
Last active April 23, 2024 10:58
Send and receive images using Flask, Numpy and OpenCV
from __future__ import print_function
import requests
import json
import cv2
addr = 'http://localhost:5000'
test_url = addr + '/api/test'
# prepare headers for http request
content_type = 'image/jpeg'
@paulhoux
paulhoux / CanvasUi.h
Created February 11, 2017 13:46
CanvasUi: a simple 2D modifier tool to drag and zoom your work area. Made for Cinder.
/*
Copyright (c) 2016, Paul Houx - All rights reserved.
This code is intended for use with the Cinder C++ library: http://libcinder.org
Redistribution and use in source and binary forms, with or without modification, are permitted provided that
the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and
the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
@cheery
cheery / vklayer
Created February 19, 2016 23:27
Run scripts with added vulkan layers
#!/usr/bin/env python
"""
Run programs with added vulkan layers.
Author: Henri Tuhola <henri.tuhola@gmail.com>
License: MIT
Date: 2016-2-20
"""
import argparse, json, os, sys
@bblanchon
bblanchon / settings.json
Created February 9, 2016 10:28
Sublime Text: Restore Quick Switch Project shortcut
{ "keys": ["ctrl+alt+p"], "command": "prompt_select_workspace" }
@asus4
asus4 / websocket_osc_bridge.py
Created December 18, 2015 05:36
WebSocket to OSC bridge
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import json
from pyOSC import OSC
from SimpleWebSocketServer import WebSocket, SimpleWebSocketServer
# arguments
@ocornut
ocornut / imgui_node_graph_test.cpp
Last active April 23, 2024 19:02
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().
@goncalossilva
goncalossilva / gifenc.sh
Last active December 12, 2023 22:31
Encode mp4, webm and gif using ffmpeg (2.6 or above). Audio is discarded on all of these!
#!/bin/sh
# sh gifenc.sh input.mp4 output.gif
# Optionally accepts width / height (one or both).
palette="/tmp/palette.png"
filters="fps=15"
if [ -n "$3" ]; then
if [ -n "$4" ]; then
filters="$filters,scale=$3:$4"
@ocornut
ocornut / printf_tips.cpp
Last active March 24, 2023 11:23
C/C++ tips for using printf-style functions
// C/C++ tips for using printf-style functions
// Lots of manipulation can be expressed simply and fast with printf-style formatting
// Also helps reducing the number of temporaries, memory allocations or copies
// ( If you are looking for a simple C++ string class that is printf-friendly and not heap-abusive,
// I've been using this one: https://github.com/ocornut/Str )
// If you are interested in a FASTER implementation of sprintf functions, see stb_sprintf.h
// https://github.com/nothings/stb/blob/master/stb_sprintf.h
// How to concatenate non-zero terminated strings