Skip to content

Instantly share code, notes, and snippets.

View reubenjohn's full-sized avatar

Reuben John reubenjohn

View GitHub Profile
@reubenjohn
reubenjohn / tensorflow_dataset_with_multiprocessing_queue.py
Created May 14, 2019 15:22
Advancing tensorflow dataset iterator in python multiprocessing Queue
from multiprocessing import Process, Queue
import numpy as np
import tensorflow as tf
def store(next_m, queue):
with tf.Session() as sess:
while True:
queue.put(sess.run(next_m))
@reubenjohn
reubenjohn / launch_distributed_horse_riders.sh
Last active September 23, 2018 17:33
Convenience shell script to launch 2 riders and 2 horses of the tensorflow distributed example: "distributed_horse_rider"
#!/usr/bin/env bash
# Note this script is part of the distributed_horse_rider example over hosted at:
# https://github.com/Project-MANAS/distributed_horse_rider
touch "/tmp/dhr.sh"; chmod +x "/tmp/dhr.sh"
launch(){
for ((i=0;i<$1;i++))
do
echo "python3.5 -m distributed_horse_rider.${2} ${i}" > "/tmp/dhr.sh" && gnome-terminal -x "/tmp/dhr.sh"
@reubenjohn
reubenjohn / rick_vnc_config_setup.sh
Created December 4, 2017 04:16
Run this file to setup your .rick_vnc_config Raw
if [ -e ~/.manas_aliases ]
then
echo ""
else
echo "Error: Please ensure .manas_aliases exists in your home directory"
if [ -e ~/.rick_vnc_config ]
then
echo ""
else
@reubenjohn
reubenjohn / main.c
Last active April 6, 2017 17:16
99 line lex analyser
#include <stdio.h>
#include <string.h>
#include <regex.h>
FILE *in,*out;
int nextChar(char buf[], int* cnt){
buf[*cnt+1] = '\0';
return fscanf(in,"%c",&buf[(*cnt)++]) > 0;
}
@reubenjohn
reubenjohn / Haskell Cheat Sheet
Created December 20, 2016 10:12
Cheat Sheet from the video posted by Derek Banas
-- Haskell is a functional programming language
-- Everything is immutable so once a value is set it is set forever
-- Functions can be passed as a parameter to other functions
-- Recursion is used often
-- Haskell has no for, while, or technically variables, but it does have
-- constants
-- Haskell is lazy in that it doesn't execute more then is needed and instead
-- just checks for errors
-- Best Free Haskell Book
import java.io.*;
import java.util.*;
import org.json.simple.JSONObject;
enum TURN{
JUMP,LEFT,RIGHT
};
class Turn{
public int pos,cnt;
public int el;
TURN cmd;
@reubenjohn
reubenjohn / Question.java
Last active March 13, 2016 19:44
An example of a class that implements SQLEntity to demonstrate the AceQLAndroid module: https://github.com/reubenjohn/aceqlandroid
public class Question implements SQLEntity {
public String title;
public String description;
public String username;
@Override
public String getEntityName() {
return "Question";
}
@reubenjohn
reubenjohn / start.bat
Created March 11, 2016 18:07
Starting Oracle and AceQl server
echo off
echo Starting up oracle
net start OracleServiceORCL
net start OracleOraDb11g_home1TNSListener
set ACEQL_HOME=your\path\to\aceql-pro-4.0-bin
echo ACEQL_HOME=%ACEQL_HOME%
echo
echo PATH=%PATH%