Skip to content

Instantly share code, notes, and snippets.

using UnityEngine;
using System;
using System.Text;
using System.Collections;
using System.Collections.Generic;
public class LSystemGenerator : MonoBehaviour
{
[Serializable]
@valbeat
valbeat / file0.cs
Created September 14, 2015 09:42
GetComponent<Rigidbody>().velocityと書くのが面倒な時 ref: http://qiita.com/kajitack/items/d5d9656467a58f6455a0
Vector3 velocity{
get{
return GetComponent<Rigidbody>().velocity;
}
set{
GetComponent<Rigidbody>().velocity = value;
}
}
if (digitalRead(BUTTON1) == 0) {
printf("%s\n", "BUTTON1");
}
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import subprocess
import wiringpi2
from time import sleep
# IO
OUTPUT = 1
INPUT = 0
HIGH = 1
#!/usr/bin/env python
from time import sleep
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(13, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(19, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
@valbeat
valbeat / video_changer.py
Created August 17, 2015 05:12
omxplayer movie changer with GPIO
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import subprocess
import wiringpi2
from time import sleep
# IO
OUTPUT = 1
INPUT = 0
HIGH = 1
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import wiringpi2
from time import sleep
import subprocess
# IO
OUTPUT = 1
INPUT = 0
#include <stdio.h>
#include <unistd.h>
#include <wiringPi.h>
#define BUTTON1 2
#define BUTTON2 3
#define BUTTON3 4
int main(void) {
@valbeat
valbeat / Fractal.cs
Created July 18, 2015 10:21
Fractal.cs
using UnityEngine;
using System.Collections;
public class Fractal : MonoBehaviour {
public int maxDepth = 4;
private int depth;
Matrix4x4 mat;
Vector3[] vertex,afterVertex;
@valbeat
valbeat / Generics.cs
Created July 11, 2015 03:53
Generics.cs
// ジェネリックにしたいメソッド
Object FindObjectOf(Type type) {
return FindObjectOfType(type);
}
// 型パワメータの名前をTとするのは慣習
T FindObjectOf<T>() where T: Component {
// 型パラメータに制限を課すことができる
return (T)FindObjectOfType(typeof(T));
}