Skip to content

Instantly share code, notes, and snippets.

View zafarali's full-sized avatar

Zafarali Ahmed zafarali

View GitHub Profile
@zafarali
zafarali / RoboschoolCluster.sh
Last active April 14, 2018 01:36
Install Roboschool on ComputeCanda Clusters. See comments for how to use
# a special thanks to the ComputeCanada support team for making available these modules on the cluster!
# using this script is pretty easy, just `wget` this into a server and then `bash RoboschoolCluster.sh`
module load python/3.5.2
module load qt
module load gcc/6.4.0
module load boost/1.65.1
# this command should not fail
pkg-config --cflags Qt5Widgets Qt5OpenGL assimp python-3.5 tinyxml
INSTALLDIR="$(pwd)/roboschool_installation"
echo "installing roboschool at $INSTALLDIR"
mkdir $INSTALLDIR
cd $INSTALLDIR
echo "Now cloning roboschool from github."
git clone https://github.com/openai/roboschool
ROBOSCHOOL_PATH="${INSTALLDIR}/roboschool"
echo "ROBOSCHOOL_PATH was set to $ROBOSCHOOL_PATH"
cd "$ROBOSCHOOL_PATH"
git clone https://github.com/olegklimov/bullet3 -b roboschool_self_collision
#!/bin/bash
pdflatex ${1}.tex
bibtex ${1}
pdflatex ${1}.tex
pdflatex ${1}.tex
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
@zafarali
zafarali / strct_test.cpp
Created July 8, 2016 19:51
demo of struct copying
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <vector>
#include <fstream>
#include <sstream>
#include <string>
using namespace std;
target friend strength class state
0 19 1 SCI1 0
1 85 1 HUM1 0
1 62 1 HUM1 0
1 38 1 HUM1 0
1 72 1 HUM1 0
2 61 1 SCI1 0
2 79 1 SCI1 0
2 48 1 SCI1 0
4 39 1 HUM1 0
@zafarali
zafarali / min-char-rnn.py
Created June 10, 2016 03:05 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
import numpy as np
import time
# the population:
global population
population = np.random.normal(-10,10, size=(10**6, 3))
def sample(args):
centre, radii = args
# print centre, radii
@zafarali
zafarali / promise_plugins.js
Created May 11, 2016 15:09
how can we string together multiple promises especially those that have request()s in them?
var q = require('q');
var request = require('request');
var context = {
query: 'hello how are you?'
} // global context to be mutated by all "plugins"
function hello_plugin(context){
var query = context.query
var contains_hello = false;
# time_values is a signal of shape: (time, n_channels)
# window data tensor is of shape: (time, window_size, n_channels)
# where window_size just holds all the data for the T-window_size data.
window_data_tensor = np.zeros((time_values.shape[0], window_size, time_values.shape[1]))
for t in range(1, time_values.shape[0]):
if t <= window_size:
window_data_tensor[t, :, :] = np.pad(time_values[:t, :], ((0, window_size-t), (0,0)), mode='constant')
elif t > window_size and t < time_values.shape[0]-window_size+1: