Skip to content

Instantly share code, notes, and snippets.

View nasser's full-sized avatar
🛰️
save-lisp-and-die

Ramsey Nasser nasser

🛰️
save-lisp-and-die
View GitHub Profile
@nasser
nasser / 1-brownian.pde
Last active August 29, 2015 14:01
Stack Syntax Sketch
int num = 2000;
int range = 6;
float[] ax = new float[num];
float[] ay = new float[num];
void setup()
{
function namedArgs(fn) {
var names = fn.toString().match(/function.*\(([^\)]+)\)/)[1].split(',');
return eval("(function(args) {\
return fn(" + names.map(function(n) { return "args[\"" + n.trim() + "\"]"}).join() + ");\
})");
}
void Start () {
InvokeRepeating ("NewTarget", 3, 3);
}
void NewTarget() {
target = GameObject.FindGameObjectsWithTag ("Enemy").Where(go => go.transform.position.z > 5).Shuffle ().FirstOrDefault ();
}
(defn start []
(invoke-repeating new-target 3 3))
(defn new-target []
(set! target (->> (unity/find :tag "Enemy") (filter #(> (.. % transform position z) 5)) (shuffle) (first)))
(defn PathFollower-Update [^UnityEngine.Component self]
(let [t (long (Time/get_time))
tf (float (Time/get_time))
^objects ary (.state self)
^object current-pos (aget ary t)
^object next-pos (aget ary (+ 1 t))
;; generates fast code because it knows the type of self and trt
^System.Type trt UnityEngine.Transform
^UnityEngine.Transform transform (.GetComponent self trt)] ;
using clojure.lang;
using System;
using UnityEngine;
public override object invoke (object obj)
{
object obj2 = PathFollowerUnity$PathFollower_Update__32.__interop_state34 (obj);
object obj3 = ((object[])obj2) [(int)Time.time];
object obj4 = ((object[])obj2) [(int)( + (double)Time.time)];
object component = ((Component)obj).GetComponent<Transform> ();
public override object invoke (object obj)
{
// runtime call to binding gone, try/finally gone
object obj2 = PathFollowerUnity$fn__28$PathFollower_Update__47__51.__interop_state53 (obj);
object obj3 = ((object[])obj2) [RT.intCast (Time.time)];
object obj4 = ((object[])obj2) [RT.intCast ((double)Time.time + (double))];
object component = ((Component)obj).GetComponent<Transform> (); // same
object result;
// same
((Transform)component).localPosition = (Vector3)(result = Vector3.Lerp ((Vector3)obj3, (Vector3)obj4, (float)Numbers.remainder ((double)Time.time, )));
@nasser
nasser / network-traffic
Last active August 29, 2015 14:05
network traffic while uploading photo to tumblr text post
Remote Address:66.6.43.30:443
Request URL:https://www.tumblr.com/svc/post/upload_text_image
Request Method:POST
Status Code:200 OK
Request Headers
:host:www.tumblr.com
:method:POST
:path:/svc/post/upload_text_image
:scheme:https
:version:HTTP/1.1
#! /bin/sh
#### NOT CONFIRMED WORKING YET ####
# on fresh ubuntu 14.04
sudo apt-get install build-essential
sudo apt-get install gcc-arm-linux-gnueabihf g++-4.8-multilib-arm-linux-gnueabihf
apt-get install pkgconfig
sudo apt-get install git # do we need this?
@nasser
nasser / atom-shell-arm-build.sh
Last active December 29, 2024 12:06
Cross compile atom-shell to ARM from Ubuntu 14.04
# from https://github.com/atom/atom-shell/blob/master/docs/development/build-instructions-linux.md
# run as root on ubuntu 14.04
# basic deps
apt-get install build-essential clang libgtk2.0-dev libnotify-dev gcc-multilib g++-multilib libgnome-keyring-dev
# node
apt-get install python-software-properties software-properties-common
add-apt-repository ppa:chris-lea/node.js
apt-get update