Skip to content

Instantly share code, notes, and snippets.

View yosun's full-sized avatar
:octocat:
cal.permute.xyz

yosun

:octocat:
cal.permute.xyz
View GitHub Profile
@olokobayusuf
olokobayusuf / GIFCreator.cs
Created November 20, 2023 13:42
Creating an animated GIF image from an array of textures in Unity with VideoKit.
public static async Task<MediaAsset> CreateGIF (Texture2D[] textures) {
// Make sure `textures` is not empty
// Make sure every texture has the same size (width and height)
// Make sure every texture has the `TextureFormat.RGBA32` format
// Create recorder
var width = textures[0].width;
var height = textures[0].height;
var frameRate = 5;
var recorder = await MediaRecorder.Create(
MediaFormat.GIF,
@seemcat
seemcat / nws3-irl-in-sf.txt
Last active May 24, 2023 06:39
buildspace n&w s3 - irl in sf
Kyle K.
Kei H.
kahron s.
Alan H.
Ashita A.
Shahir A.
Moin B.
Mustafa T.
arib k.
Omar K.
@jschoormans
jschoormans / equirectangular.py
Created December 8, 2022 23:08
generate 3D panorama views with stable diffusion
# %%
import replicate
model = replicate.models.get("prompthero/openjourney")
version = model.versions.get("9936c2001faa2194a261c01381f90e65261879985476014a0a37a334593a05eb")
PROMPT = "mdjrny-v4 style 360 degree equirectangular panorama photograph, Alps, giant mountains, meadows, rivers, rolling hills, trending on artstation, cinematic composition, beautiful lighting, hyper detailed, 8 k, photo, photography"
output = version.predict(prompt=PROMPT, width=1024, height=512)
# %%
# download the iamge from the url at output[0]
import requests
@elringus
elringus / SetTextureProperty.cs
Created January 15, 2022 08:40
Assign main texture property via the BlendModeEffect
using BlendModes;
using UnityEngine;
[RequireComponent(typeof(BlendModeEffect))]
public class SetTextureProperty : MonoBehaviour
{
public Texture2D Texture;
[ContextMenu("Set Texture")]
public void SetTexture ()
@itsderek23
itsderek23 / booklet_ai_policy.json
Created March 19, 2020 21:36
Booklet.ai AWS JSON Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"sagemaker:ListEndpointConfigs",
"sagemaker:DescribeEndpointConfig",
"sagemaker:ListModels",
@yosun
yosun / Image2GoogleVision.cs
Created October 4, 2019 02:01
Takes a Unity Texture2D and get a Google Cloud vision annotation response. Please replace api key accordingly and *make sure Google Cloud billing is enabled*
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GoogleCloudVision {
[System.Serializable]
public class AnnotateImageRequests
{
public List<AnnotateImageRequest> requests;
@bitsurgeon
bitsurgeon / youtube.md
Last active May 5, 2024 06:44
Markdown cheatsheet for YouTube

Embed YouTube Video in Markdown File

  1. Markdown style
[![Watch the video](https://img.youtube.com/vi/nTQUwghvy5Q/default.jpg)](https://youtu.be/nTQUwghvy5Q)
  1. HTML style
<a href="http://www.youtube.com/watch?feature=player_embedded&v=nTQUwghvy5Q" target="_blank">
@ddutchie
ddutchie / Flashlight.mm
Last active March 12, 2024 10:20
Native Flash Light Controller for Unity3D and iOS
#import <AVFoundation/AVFoundation.h>
extern "C" {
void _EnableFlashlight(bool enable) {
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ([device hasTorch]) {
[device lockForConfiguration:nil];
[device setTorchMode:enable ? AVCaptureTorchModeOn : AVCaptureTorchModeOff];
[device unlockForConfiguration];
# Read more about setting it up
# https://medium.com/@ljmocic/running-a-script-from-s3-on-ec2-with-7-lines-of-code-59806c07d300
import boto3
REGION = 'us-east-1'
AMI = 'ami-00b94673edfccb7ca'
INSTANCE_TYPE = 'm3.medium'
BUCKET = 'script-bucket'
@vmchar
vmchar / ReplaceDelegatePostProcess.cs
Created November 17, 2018 20:46
Unity3D iOS post build process to replace app delegate source
using UnityEditor;
using UnityEditor.Callbacks;
using UnityEditor.iOS.Xcode;
using UnityEngine;
namespace QuickActionsiOS
{
public class ReplaceDelegatePostProcess : ScriptableObject
{
/// <summary>