Skip to content

Instantly share code, notes, and snippets.

Kory Becker primaryobjects

Block or report user

Report or block primaryobjects

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@primaryobjects
primaryobjects / background.js
Last active Jun 7, 2019
Chrome Extension example to trigger the permission update warning.
View background.js
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(tab) {
// No tabs or host permissions needed!
console.log('Turning ' + tab.url + ' red!');
chrome.tabs.executeScript({
code: 'document.body.style.backgroundColor="red"'
@primaryobjects
primaryobjects / havelHakimi.R
Created May 30, 2019
[2019-05-20] Challenge #378 [Easy] The Havel-Hakimi algorithm for graph realization. Demo at https://repl.it/repls/OpulentExcitableInterfaces
View havelHakimi.R
havelHakimi <- function(data) {
result <- F
repeat {
# Remove all 0's.
data <- data[data != 0]
if (length(data) == 0) {
result <- T
break
}
@primaryobjects
primaryobjects / commonsense.md
Last active Jul 7, 2019
Thoughts on Common Sense Artificial Intelligence
View commonsense.md

Thoughts on Common Sense Artificial Intelligence

I wanted to share some thought-provoking ideas from a recent talk that I attended on "Building AI with Common Sense", presented by Ernest Davis, professor of Computer Science at New York University. His research focuses on the automation of common sense, spatial, and physical reasoning.

The image below really sets the tone for the topic. Can you see what's happening?

Amazon Image Recognition processed this image and is 98% confident that it sees a "Robot" and a "Toy". Those are correct, from a limited sense. However, do you see what the robot is doing? The common sense aspect of this image is probably the most important part of it!

Most of the AI that we're familiar with centers upon machine learning, statistical based learning, sourced from training sets. This has demonstrated significant advances in recent years, especially from neural networks and deep learnin

@primaryobjects
primaryobjects / 1-readme.md
Created May 8, 2019
Programming by Example proof-of-concept implementation with a machine learning model based on input/output features.
View 1-readme.md

Programming By Example

The following program is a basic proof-of-concept implementation of the program synthesis technique of Programming by Example, as included in Microsoft Excel FlashFill.

The Data Set

The data-set "features.csv" consists of extracted features from input/output examples, as a user would provide prior to beginning program synthesis. For example, to produce a program that extracts the first character of every input string, the user might give examples of strings as input with lengths of 1, 2, or 5 characters and an output example of a single character. We can guess the most likely program to select as a solution might be "firstCharacter". Similarly, if the input consists of numbers, we can guess the most likely program to select as a solution might be "addition".

Large Database of Programs

@primaryobjects
primaryobjects / boxes.R
Last active May 3, 2019
[2019-04-08] Challenge #377 [Easy] Axis-aligned crate packing in R. Demo https://repl.it/repls/StarchyGrippingMath
View boxes.R
#
# [2019-04-08] Challenge #377 [Easy] Axis-aligned crate packing
# https://www.reddit.com/r/dailyprogrammer/comments/bazy5j/20190408_challenge_377_easy_axisaligned_crate/
#
# Given X, Y, x, and y, determine how many boxes can fit into a single crate if they have to be placed so that the x-axis of the boxes is aligned with the x-axis of the crate, and the y-axis of the boxes is aligned with the y-axis of the crate. That is, you can't rotate the boxes. The best you can do is to build a rectangle of boxes as large as possible in each dimension.
# For instance, if the crate is size X = 25 by Y = 18, and the boxes are size x = 6 by y = 5, then the answer is 12. You can fit 4 boxes along the x-axis (because 6*4 <= 25), and 3 boxes along the y-axis (because 5*3 <= 18), so in total you can fit 4*3 = 12 boxes in a rectangle.
#
# Demo https://repl.it/repls/StarchyGrippingMath
#
@primaryobjects
primaryobjects / oneToEachDigit.R
Created Mar 27, 2019
[2019-02-11] Challenge #375 [Easy] Print a new number by adding one to each digit. Demo at https://repl.it/repls/SickInnocentCoding
View oneToEachDigit.R
#
# [2019-02-11] Challenge #375 [Easy] Print a new number by adding one to each of its digit
# For example, 998 becomes 10109.
#
# Bonus
# Solve without using strings.
#
# https://www.reddit.com/r/dailyprogrammer/comments/aphavc/20190211_challenge_375_easy_print_a_new_number_by/
#
@primaryobjects
primaryobjects / 1-quickbot.gif
Last active Mar 12, 2019
Controlling Mobile Robots Week 4 Programming Assignment Avoid Obstacles
@primaryobjects
primaryobjects / 1-quickbot.md
Last active Mar 10, 2019
Controlling Mobile Robots Week 3 Programming Assignment GoToGoal
View 1-quickbot.md

GoToGoal Controller

This project implements a GoToGoal controller for the QuickBot differential drive robot.

A screenshot of the robot successfully turning and driving towards the goal coordinate can be seen below in the first image. As seen in the recording, the robot is able to quickly and smoothly turn towards the goal position. This is controlled by the value selected for the PID gain factor obj.Kp = 2 in the GoToGoal.m constructor.

If the selected value for the PID gain is too small or large, the robot may be unable to reach the goal.

Too Large PID Gain

@primaryobjects
primaryobjects / 1-face.png
Last active Mar 6, 2019
Drawing a face by calculating the x,y points along a circle's circumference for https://easyprog.online/ide/
@primaryobjects
primaryobjects / 1-quickbot-3.gif
Last active Mar 5, 2019
Control of Mobile Robots, Coursera - Week 2 Programming Assignment: Differential Drive Dynamics, Robot Odometry, IR Range Sensors
You can’t perform that action at this time.