Skip to content

Instantly share code, notes, and snippets.

@mashiro
mashiro / message.hpp
Last active June 15, 2023 09:54
zeromq + msgpack
#include <string>
#include <ctime>
#include <msgpack.hpp>
struct message
{
std::string tag;
std::time_t time;
std::string text;
MSGPACK_DEFINE(tag, time, text);
@Farfarer
Farfarer / CubemapToEquirectangularWizard.cs
Last active July 2, 2024 06:54
Create dynamic equirectangular maps for Unity. These have the benefit that, as they're flat images, you can sample lower mips to get blurry reflections. The straight cubemap version (detailed here: http://www.farfarer.com/blog/2011/07/25/dynamic-ambient-lighting-in-unity/ ) will give you hard seams when you sample mips from the cubemap. Although…
// Wizard to convert a cubemap to an equirectangular cubemap.
// Put this into an /Editor folder
// Run it from Tools > Cubemap to Equirectangular Map
using UnityEditor;
using UnityEngine;
using System.IO;
class CubemapToEquirectangularWizard : ScriptableWizard {
@tsubaki
tsubaki / LoadTexture.cs
Last active July 16, 2019 09:48
ネイティブプラグインが作成したテクスチャをUnityで使用するサンプル
using UnityEngine;
using System;
using System.Runtime.InteropServices;
public class LoadTexture : MonoBehaviour {
[DllImport ("__Internal")]
private static extern IntPtr CreateTexture(string filename, out int w, out int h);
Texture2D tex = null;
@roxlu
roxlu / H264_Decoder.cpp
Created March 3, 2014 16:57
LibAV parser and decoder example with openGL (YUV420 -> RGB shader).
#include "H264_Decoder.h"
H264_Decoder::H264_Decoder(h264_decoder_callback frameCallback, void* user)
:codec(NULL)
,codec_context(NULL)
,parser(NULL)
,fp(NULL)
,frame(0)
,cb_frame(frameCallback)
,cb_user(user)
@AlexanderDzhoganov
AlexanderDzhoganov / DebugUtil.cs
Created March 14, 2015 14:08
Dump RenderTexture to PNG in Unity
public static class DebugUtil
{
public static void DumpRenderTexture(RenderTexture rt, string pngOutPath)
{
var oldRT = RenderTexture.active;
var tex = new Texture2D(rt.width, rt.height);
RenderTexture.active = rt;
tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);
@JasonGhent
JasonGhent / pi_qemu.sh
Last active March 24, 2024 14:36
OSX raspberry pi emulation via QEMU. v2 attempt @ https://gist.github.com/JasonGhent/922f38f57c8cb77b10f3
# pulled from http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/
# expanded via http://superuser.com/questions/690060/how-to-enable-network-with-a-raspberry-pi-emulated-on-qemu
# tested with 2015-02-16-raspbian-wheezy.zip on OSX Mavericks
# OSX terminal
brew install qemu
# kernel-qemu is a linux kernel compiled with ARM1176 support.
# learn more here: http://xecdesign.com/compiling-a-kernel/
curl -OL http://xecdesign.com/downloads/linux-qemu/kernel-qemu
curl -o raspbian_latest.zip -L http://downloads.raspberrypi.org/raspbian_latest
@yohhoy
yohhoy / ff2cv.cpp
Last active April 12, 2024 06:49
Read video frame with FFmpeg and convert to OpenCV image
/*
* Read video frame with FFmpeg and convert to OpenCV image
*
* Copyright (c) 2016 yohhoy
*/
#include <iostream>
#include <vector>
// FFmpeg
extern "C" {
#include <libavformat/avformat.h>
@fishkingsin
fishkingsin / build.sh
Created July 25, 2016 08:05
script to build ffmpeg and x264 for android
#!/bin/bash
#
# Author: Renato L. F. Cunha <renatoc@gmail.com>
# This file is available according to the MIT license. Please refer to the
# LICENSE file for details.
#
# This script builds a version of FFmpeg with h.264 support enabled by means of
# the libx264 library.
#
@asus4
asus4 / GraphAttribute.cs
Last active June 13, 2024 10:47
Show graph as unity custom attribute
/*
MIT License
Copyright (c) 2021 Koki Ibukuro
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@jhorology
jhorology / gist:f05a0f00cfeb12c3751dfcd9f047c72c
Created September 15, 2016 00:24
Compiling Ableton/link with Qt on OSX
brew install qt5
brew linkapp qt5
brew link --force qt5
ln -s /usr/local/opt/qt5/mkspecs /usr/local/mkspecs
ln -s /usr/local/opt/qt5/plugins /usr/local/plugins
git clone https://github.com/Ableton/link.git
cd link
git submodule update --init --recursive
mkdir build
cd build