Skip to content

Instantly share code, notes, and snippets.

View damanm24's full-sized avatar

Daman Mulye damanm24

View GitHub Profile
@damanm24
damanm24 / gist:447227f0b6b5ba4844d96e9dfc50edd9
Last active June 9, 2017 03:52
Accessing properties/indexes of unknown object in JavaScript
function NewPollCtrl($scope, $http, $location, $q) {
$scope.poll = {
options: [{
text: ''
}, {
text: ''
}]
};
$scope.cbstate = "not-pressed";
@damanm24
damanm24 / .js
Last active June 9, 2017 06:01
Promise Inception
let promiseURL = function(searchTerm) {
return new Promise(function(resolve, reject) {
$http.get('https://api.cognitive.microsoft.com/bing/v5.0/images/search?q=' + searchTerm + '&count=1&offset=0&mkt=en-us&safeSearch=Strict', {
headers: {
'Ocp-Apim-Subscription-Key': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
}
}).success(function(response) {
resolve(response);
}).error(function(err, status) {
reject(err);
@damanm24
damanm24 / led_controller.ino
Created June 9, 2019 20:19
Music Reactive LED lights
/**
* LED Music Visualizer
* by Daman Mulye
* adapted from: https://github.com/hansjny/Natural-Nerd/tree/master/SoundReactive2
* using the FastLED library: http://fastled.io/
* June 9, 2019
*/
#include <FastLED.h>
#include "reactive_commons.h"
@damanm24
damanm24 / music_reactive.ino
Created September 16, 2019 19:30
music_reactive
/**
* LED Music Visualizer
* by Daman Mulye
* adapted from: https://github.com/hansjny/Natural-Nerd/tree/master/SoundReactive2
* using the FastLED library: http://fastled.io/
* June 9, 2019
*/
#include <FastLED.h>
#include "reactive_commons.h"
from scheduling.misc import *
from scheduling.TaskEntity import *
# read the input bounding box data from file
box_info = read_json_file('../dataset/waymo_ground_truth_flat.json')
frame_num = 0
boxes = {}
from scheduling.misc import *
from scheduling.TaskEntity import *
# read the input bounding box data from file
box_info = read_json_file('../dataset/waymo_ground_truth_flat.json')
def process_frame(frame):
"""Process frame for scheduling.
cluster_boxes_data = get_cluster_box_info(frame, box_info)
task_batches = []
cluster_boxes_data.sort(key=lambda x : (x[2] - x[0]) * (x[3] - x[1]))
# student's code here
for i in range(len(cluster_boxes_data)):
task = TaskEntity(image_path=frame.path, coord=cluster_boxes_data[i][:4], depth=cluster_boxes_data[i][4])
task_batch = TaskBatch([task], task.img_width, task.img_height, priority=i)