Skip to content

Instantly share code, notes, and snippets.

View DavidYKay's full-sized avatar

David Young-Chan Kay DavidYKay

View GitHub Profile
@DavidYKay
DavidYKay / centroid.py
Created July 10, 2016 20:51
Best fit plane: vertices, normal, centroid
[ 0.21040269, 0.2235437, 0.07060108]
@DavidYKay
DavidYKay / Car.cpp
Created July 7, 2016 21:10
C++ Class / Header file example
#import "Car.h"
const int ACCELERATION_FACTOR = 10;
const int BRAKING_FACTOR = 30;
Car::Car() {
speed = 0;
}
void Car::accelerate(float intensity) {
@DavidYKay
DavidYKay / .zshrc
Created May 2, 2016 17:48
Sexy two-line shell config for ZSH
#****************************************
#BEGIN PROMPT
#****************************************
function precmd {
local TERMWIDTH
(( TERMWIDTH = ${COLUMNS} - 1 ))

Keybase proof

I hereby claim:

  • I am davidykay on github.
  • I am davidykay (https://keybase.io/davidykay) on keybase.
  • I have a public key ASAt80YHH2ECRtfB7tculSNU4eKXpkzlzxGEmcFkA-f8wwo

To claim this, I am signing this object:

@DavidYKay
DavidYKay / square-root.clj
Created March 22, 2016 05:47
Implementation of the square root function, based on SICP Lecture 1A
(ns example.square-root)
(def tolerance 0.00000000001)
(defn square [x]
(* x x))
(defn avg [& args]
(/ (apply + args)
(count args)))
@DavidYKay
DavidYKay / hello-hiccup.cljs
Created January 19, 2016 05:03
Examples for Clojurescript Workshop 1/19/2016
[:div.top-bar-right
[:ul.menu
[:li [:a {:href "#"} "History"]]
[:li [:a {:href "#"} "Log Out"]]]]
package printtextlocations;
import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.pdfbox.exceptions.InvalidPasswordException;
@DavidYKay
DavidYKay / crash.log
Created May 2, 2015 21:41
NullPointerException in RoboVM IntelliJ Plugin when loading project with 3 modules: ios, android, common
null
java.lang.NullPointerException
at org.robovm.idea.RoboVmPlugin.isRoboVmModule(RoboVmPlugin.java:338)
at org.robovm.idea.interfacebuilder.IBIntegratorModuleComponent.moduleAdded(IBIntegratorModuleComponent.java:46)
at com.intellij.openapi.module.impl.ModuleImpl.moduleAdded(ModuleImpl.java:232)
at com.intellij.openapi.module.impl.ModuleManagerImpl$6.run(ModuleManagerImpl.java:998)
at com.intellij.openapi.roots.impl.ProjectRootManagerImpl.makeRootsChange(ProjectRootManagerImpl.java:363)
at com.intellij.openapi.module.impl.ModuleManagerImpl.commitModel(ModuleManagerImpl.java:954)
at com.intellij.openapi.module.impl.ModuleManagerImpl.access$1300(ModuleManagerImpl.java:73)
at com.intellij.openapi.module.impl.ModuleManagerImpl$ModuleModelImpl.commitWithRunnable(ModuleManagerImpl.java:850)
@DavidYKay
DavidYKay / simple_cb.py
Last active June 26, 2023 00:52
Simple color balance algorithm using Python 2.7.8 and OpenCV 2.4.10. Ported from: http://www.morethantechnical.com/2015/01/14/simplest-color-balance-with-opencv-wcode/
import cv2
import math
import numpy as np
import sys
def apply_mask(matrix, mask, fill_value):
masked = np.ma.array(matrix, mask=mask, fill_value=fill_value)
return masked.filled()
def apply_threshold(matrix, low_value, high_value):
@DavidYKay
DavidYKay / error.log
Created March 25, 2015 17:29
Shrimp example: "Unable to mount WebDav" on attempting to connect to REPL
$ script/jscrepljs
[1] Shrimp on iPhone Simulator (ikong-home)
[R] Refresh
Choice: 1
java.lang.Exception: Unable to mount WebDAV at http://192.168.1.9:49153
at ambly.repl.jsc$mount_webdav.invoke(jsc.clj:260)
at ambly.repl.jsc$setup.invoke(jsc.clj:282)