Skip to content

Instantly share code, notes, and snippets.

View tcw165's full-sized avatar
💭
building AI

TC Wang tcw165

💭
building AI
View GitHub Profile
@novodimaporo
novodimaporo / NV21Utils.cpp
Last active June 11, 2021 09:12
NV21 Utils
void convertNV21ToArray2d(JNIEnv* env, dlib::array2d<dlib::rgb_pixel>& out,
jbyteArray data, jint width, jint height) {
jbyte* yuv = env->GetByteArrayElements(data, 0);
int frameSize = width * height;
int y, u, v, uvIndex;
int r, g, b;
out.set_size((long) height, (long) width);
for(int row = 0; row < height; row++) {
@dboyliao
dboyliao / DFS.py
Created May 29, 2016 17:17
Simple implementation of DFS (Depth First Search)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def DFS(graph, root_node = "root"):
stack = []
children = graph[root_node]
stack = children + stack
print(root_node)
@tcw165
tcw165 / ImageUtil.java
Last active May 26, 2018 11:40
The Android's image helper class
// Copyright (c) 2016 boyw165
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import numpy as np
import random
"""
Simple Back-Propagation Neural Network.
Basic Usage:
@TooTallNate
TooTallNate / bbs.js
Created March 16, 2012 22:42
Running a node.js REPL over `curl`
/**
* Requires node v0.7.7 or greater.
*
* To connect: $ curl -sSNT. localhost:8000
*/
var http = require('http')
, repl = require('repl')
, buf0 = new Buffer([0])