Skip to content

Instantly share code, notes, and snippets.

View niittymaa's full-sized avatar

Sakari Niittymaa niittymaa

View GitHub Profile
def is_firefly(rgba):
if (any(rgba) == 1.0) and (sum(rgba) > 3.8):
return True
""" found coordinates to look at """
pixels_of_interest = [[28,764]]
#[ [424,706], [178,864], [67,68], [58,110],
# [16,123], [21,169], [81,218], [49,422],
# [56,603], [29,637], [60,643], [31,686],
@niittymaa
niittymaa / more_image_manipulation.py
Created February 11, 2020 08:07 — forked from zeffii/more_image_manipulation.py
more_image_manipulation.py
import bpy
D = bpy.data
test_file = 'firefly_test_pattern_2.tga'
# my test image is 24 px wide and 7 px heigh
# download here if you want to test along.
#alias if you can
img = D.images[test_file]
# https://blender.stackexchange.com/q/57306/3710
bl_info = {
"name": "Add-on Template",
"description": "",
"author": "p2or",
"version": (0, 0, 3),
"blender": (2, 80, 0),
"location": "3D View > Tools",
"warning": "", # used for warning icon and text in addons panel
@niittymaa
niittymaa / DistanceJoint3D.cs
Created December 2, 2018 00:20 — forked from ditzel/DistanceJoint3D.cs
Rope Physics
using UnityEngine;
public class DistanceJoint3D : MonoBehaviour {
public Transform ConnectedRigidbody;
public bool DetermineDistanceOnStart = true;
public float Distance;
public float Spring = 0.1f;
public float Damper = 5f;
@niittymaa
niittymaa / CleanUpWindow.cs
Created November 4, 2018 11:50 — forked from karl-/CleanUpWindow.cs
New interface for removing unused Unity assets
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections;
using System.Collections.Generic;
public class CleanUpWindow : EditorWindow
{
bool groupEnabled = true;
List<string> usedAssets = new List<string>();
@niittymaa
niittymaa / split-skymap-into-images.py
Created November 3, 2018 11:26 — forked from CanOfColliders/split-skymap-into-images.py
Simple script to split a cubemap/skymap image produced by blender into 6 separated image files for use in Unity3Ds skybox materials.
#!/usr/bin/env python
# Will split a png cubemap/skymap image produced by blender into 6 separated image files for use in a skybox within unity
# Requires Python Imaging Library > http://www.pythonware.com/products/pil/
# The author takes no responsibility for any damage this script might cause,
# feel free to use, change and or share this script.
# 2013-07, CanOfColliders, m@canofcolliders.com
from PIL import Image
@niittymaa
niittymaa / open-w-atom.reg
Created March 2, 2017 23:55 — forked from kyle-ilantzis/open-w-atom.reg
Adds 'Open in Atom' to context menu in Windows Explorer.
Windows Registry Editor Version 5.00
;
; Adds 'Open in Atom' to context menu (when you right click) in Windows Explorer.
;
; Based on https://github.com/Zren/atom-windows-context-menu. It didn't work
; https://github.com/Zren/atom-windows-context-menu/issues/1.
;
; Save this file to disk with a .reg extension. Replace C:\\Atom\\atom.exe with
; the path to the atom executable on your machine.
@niittymaa
niittymaa / paths.php
Created February 12, 2017 23:16 — forked from lavoiesl/paths.php
PHP Document Root, Path and URL detection.
<?php
$base_dir = __DIR__; // Absolute path to your installation, ex: /var/www/mywebsite
$doc_root = preg_replace("!${_SERVER['SCRIPT_NAME']}$!", '', $_SERVER['SCRIPT_FILENAME']); # ex: /var/www
$base_url = preg_replace("!^${doc_root}!", '', $base_dir); # ex: '' or '/mywebsite'
$protocol = empty($_SERVER['HTTPS']) ? 'http' : 'https';
$port = $_SERVER['SERVER_PORT'];
$disp_port = ($protocol == 'http' && $port == 80 || $protocol == 'https' && $port == 443) ? '' : ":$port";
$domain = $_SERVER['SERVER_NAME'];
$full_url = "${protocol}://${domain}${disp_port}${base_url}"; # Ex: 'http://example.com', 'https://example.com/mywebsite', etc.
@niittymaa
niittymaa / importJSON.jsx
Created February 9, 2017 13:39
Function for reading JSON files into Indesign
/*
extended javascript for
Adobe Indesign 5.5
by
PDXIII
http://about.me/PDXIII
Honestly: It's from fabiantheblind, but I typed it ;-)
*/
@niittymaa
niittymaa / UIparallax.html
Created February 5, 2017 10:51 — forked from anestv/UIparallax.html
Parallax scrolling for Semantic UI
<html>
<head>
<style>
/* user styles */
body {
max-width: 900px;
margin: auto;
padding: 1em;
}