Skip to content

Instantly share code, notes, and snippets.

@n1ckfg
n1ckfg / RandomScreenPos.cs
Created November 1, 2016 14:45
Random screen position Unity
using UnityEngine;
using System.Collections;
public class RandomScreenPos : MonoBehaviour {
void Update() {
float x = Random.Range(0f, Screen.width);
float y = Random.Range(0f, Screen.height);
float z = Random.Range(Camera.main.nearClipPlane, Camera.main.farClipPlane);
transform.position = Camera.main.ScreenToWorldPoint(new Vector3(x, y, z));
@n1ckfg
n1ckfg / pil_hello.py
Last active January 22, 2018 15:10
Python Imaging Library / PIL / Pillow hello-world
# http://effbot.org/imagingbook/introduction.htm
# https://en.wikibooks.org/wiki/Python_Imaging_Library/Editing_Pixels
import PIL.Image as Image
inputFilePath = "test.jpg"
outputFilePath = "out.png"
img = Image.open(inputFilePath)
print (str(img.format) + " " + str(img.size) + " " + str(img.mode))
@n1ckfg
n1ckfg / ae_batch_example.js
Last active February 27, 2018 00:22
After Effects batch example
function uprez() {
app.beginUndoGroup("Uprez");
var theComps = getSelectedComps();
if (theComps.length < 1) {
alert("No comps selected.");
} else {
for (var i=0; i<theComps.length; i++) {
theComp = theComps[i];
@n1ckfg
n1ckfg / interactive_inpainting.pde
Last active August 18, 2017 18:22 — forked from atduskgreg/interactive_inpainting.pde
Interactive in-painting with OpenCV for Processing
// updated for Processing 3
import gab.opencv.*;
import org.opencv.photo.Photo;
import org.opencv.imgproc.Imgproc;
import processing.opengl.PGraphics2D;
PImage src;
PGraphics2D canvas;
"use strict"
function setup(classDays) {
// var classDays = [ [7, 9, 17], [14, 9, 17], [21, 9, 17], [28, 9, 17], [5, 10, 17], [19, 10, 17], [26, 10, 17], [2, 11, 17], [9, 11, 17], [16, 11, 17], [23, 11, 17], [30, 11, 17] ];
var doCalendar = true;
//get the day
var myDays = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" ];
@n1ckfg
n1ckfg / ZipExample.cs
Created September 20, 2017 13:36
Compress and decompress using SharpZipLib in Unity
// http://www.sebaslab.com/how-to-compress-and-decompress-binary-stream-in-unity/
using ICSharpCode.SharpZipLib.BZip2;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
static void Compress (string nameOfTheFileToSave, ISerializable objectToSerialize)
{
using (FileStream fs = new FileStream(nameOfTheFileToSave, FileMode.Create))
{
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0;url=./destination"/>
</head>
<body>
</body>
@n1ckfg
n1ckfg / g_processing.py
Last active October 4, 2017 14:50
Test whether g is accessible in Processing's Python mode
# https://github.com/jdf/processing.py/issues/280
def setup():
size(300, 300, P3D)
def draw():
if frameCount == 1:
g.textFont(loadFont("Impact-48.vlw"))
g.textMode(SCREEN)
g.fill(0)
@n1ckfg
n1ckfg / finalik_offsets.txt
Created October 11, 2017 01:16
FinalIK Vive offsets
Neck
0
-0.07827437
-0.1752148
0
-90.00001
-90.00001
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<style type="text/css">
body, html {
margin: 0; padding: 0; height: 100%; overflow: hidden;
}