Skip to content

Instantly share code, notes, and snippets.

View tigercosmos's full-sized avatar
🙃
Feel free to reach me!

Liu, An-Chi tigercosmos

🙃
Feel free to reach me!
View GitHub Profile
@tigercosmos
tigercosmos / smallvec.cpp
Created June 22, 2022 14:06
Small Vector Implementation
#include <array>
#include <stdexcept>
#include <algorithm>
#include <vector>
#include <iostream>
#include <initializer_list>
template <typename T, size_t N = 10>
class SmallVec
{
@tigercosmos
tigercosmos / Calculator.js
Created October 9, 2020 15:05
Simple Test Tutorial
class Calculator {
constructor() {
}
add(a, b) {
return a + b;
}
sub(a, b) {
@tigercosmos
tigercosmos / bovw.py
Last active June 7, 2022 12:47
Bag of Visual Words with SVM
#!/usr/bin/env python
# coding: utf-8
import numpy as np
import cv2
import os
import math
from cyvlfeat.kmeans import kmeans
from scipy import ndimage
from scipy.spatial import distance
{
"bin": {
"sh": null
},
"boot": {
"kernel.js": null
},
"index.json": null,
"spec": {
"cpu2006_asmjs": {
[ 0%] Built target LLVMDemangle
[ 0%] Built target LLVMTableGen
[ 2%] Built target obj.llvm-tblgen
[ 2%] Built target LLVMHello_exports
[ 6%] Built target LLVMSupport
[ 7%] Built target LLVMMCParser
[ 7%] Built target LLVMMCDisassembler
[ 9%] Built target LLVMMC
[ 10%] Built target LLVMObjectYAML
[ 11%] Built target LLVMDebugInfoDWARF
@tigercosmos
tigercosmos / image-stitching-using-sift-ransac.ipynb
Created May 21, 2020 17:24
Image stitching using SIFT and RANSAC
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -------------------------------------------------------------------------------
# Agent-based SIR Model
# Author: Liu An Chi @tigercosmos
# -------------------------------------------------------------------------------
from pylab import *
from scipy import interpolate
from random import random
from math import log
from enum import Enum
# -------------------------------------------------------------------------------
# SIR Model
# Author: Liu An Chi @tigercosmos
# -------------------------------------------------------------------------------
from pylab import *
from scipy import interpolate
# Parameters
Beta = 1
Gamma = 0.5
/// Make CPUs usage as a sin wave
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <unistd.h>
const float PI = 3.1415926;
const int TIME_SLICE = 40000; // 40 ms
// .....
} else if (match[DAY_GROUP_1]) { // 處理中文字有關於「天」的部分
var day1 = match[DAY_GROUP_1];
var time1 = match[TIME_GROUP_1];
if (day1 == '明' || day1 == '聽') {
// 如果半夜說明天,通常是今天的概念
if(refMoment.hour() > 1) {
startMoment.add(1, 'day');
}