Skip to content

Instantly share code, notes, and snippets.

View subwaymatch's full-sized avatar

Ye Joo Park subwaymatch

View GitHub Profile
@subwaymatch
subwaymatch / index.js
Last active August 21, 2019 05:29
React Keyboard Shortcuts using Mousetrap
import React from "react";
import ReactDOM from "react-dom";
const Mousetrap = require("mousetrap");
class App extends React.Component {
constructor() {
super();
this.state = {
@subwaymatch
subwaymatch / opencv-test.cpp
Last active September 13, 2019 22:40
Sample OpenCV app
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main()
{

Assignment 05

Name: Ye Joo Park USCID: 1128685151 Email: yejoopar@usc.edu

Overview

This report outlines the steps I've followed to implement autocomplete, spell correction, and snippet generation features.

Feature 1 - Autocomplete

@subwaymatch
subwaymatch / authmiddleware.cs
Created July 6, 2018 21:29
Basic authentication middleware for API testing with .NET Core 2.0 + Identity
// Basic auth for API authorization test
app.Use(async (context, next) =>
{
string authHeader = context.Request.Headers["Authorization"].ToString();
if (authHeader != null && authHeader.StartsWith("Basic "))
{
string encodedUsernamePassword = authHeader.Substring("Basic ".Length).Trim();
Encoding encoding = Encoding.GetEncoding("UTF-8");
string usernamePassword = encoding.GetString(Convert.FromBase64String(encodedUsernamePassword));
@subwaymatch
subwaymatch / set_accumulator_pyspark.py
Created June 24, 2018 22:28
A set() type accumulator for pyspark
from pyspark import SparkContext
from pyspark.accumulators import AccumulatorParam
class SetParam(AccumulatorParam):
def zero(self, initial_value):
return initial_value.copy()
def addInPlace(self, set1, set2):
return set1.union(set2)
import numpy as np
import cv2
import sys
print("Python version: " + sys.version)
print("OpenCV version: " + cv2.__version__)
MIN_MATCH_COUNT = 4
img1 = cv2.imread('data/image1.jpg', cv2.IMREAD_GRAYSCALE) # queryImage
@subwaymatch
subwaymatch / measure-border-width.cpp
Last active July 5, 2017 04:59
Find white border widths from roi
#pragma warning(disable: 4819)
#include <iostream>
#include "opencv2/opencv.hpp"
using namespace std;
using namespace cv;
void find_width(const Mat& src_bin, const vector<Rect>& roi, vector<int>& border_widths);
@subwaymatch
subwaymatch / deleteDanglingRawFiles.py
Created February 23, 2017 15:39
Find and delete dangling CR2 files from a folder
import os
basepath = "C:\\Your\\Base\\Path"
# A list of all CR2 files
cr2files = []
# Get list of all files in given directory
for fname in os.listdir(basepath):