This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//#load "Spirograph.fs" | |
open System.Drawing | |
//open FSharp.TV.Spirograph | |
let round (x:float) = int (System.Math.Round (x)) | |
module Seq = | |
let repeat items = | |
seq { while true do for item in items do yield item } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class FormationController : MonoBehaviour { | |
public GameObject enemyPrefab; | |
public float width = 10; | |
public float height = 5; | |
public float speed; | |
public float padding; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class ChangeOnCollision : MonoBehaviour { | |
private Material myMaterial; | |
// Use this for initialization | |
void Start () { | |
myMaterial = GetComponent<Renderer>().material; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class ChangeOnCollision : MonoBehaviour { | |
private Material myMaterial; | |
void Start () { | |
myMaterial = GetComponent<Renderer>().material; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma strict | |
var damage = 20; | |
var vel = Vector2(0,10); | |
var boom : AudioClip; | |
function Start () { | |
rigidbody2D.velocity = vel; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#define SMARTY_SIZE_INIT 16 | |
typedef struct { | |
char * str; // a null terminated C string | |
char * end; // a pointer to the null byte, to be able to repeatedly append | |
// without using strlen() every time. | |
size_t size; // currently allocated size for *str, so we know when we |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#if defined(SMALL) | |
#define SIZE 30 | |
#endif | |
#if defined(LARGE) | |
#define SIZE 3000 | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* random.c */ | |
#include <stdio.h> | |
#include <time.h> | |
#include <stdlib.h> | |
void parser(char *input, double particles[][4]){ | |
sscanf( | |
input, | |
"p[20] = nullvector(%lf,%lf,%lf,%lf)", | |
&particles[20][3], &particles[20][0], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int genIV( | |
void* buffer, | |
int buffer_len | |
){ | |
/* | |
* Note that we propagate the return code from the library called. | |
*/ | |
#ifndef _WIN32 | |
return RAND_bytes(buffer, buffer_len); | |
#else |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.security.SecureRandom; | |
public static byte[] genIV(int len) throws Exception{ | |
byte[] arr = new byte[len]; | |
SecureRandom prng = SecureRandom.getInstance("SHA1PRNG"); | |
prng.nextBytes(arr); | |
return arr; | |
} |