Skip to content

Instantly share code, notes, and snippets.

🎯
Coding

Inhzus inhzus

🎯
Coding
Block or report user

Report or block inhzus

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
View string_split.cc
void split(const std::string &s,
const std::string &delim,
const std::function<void(const std::string &)> &f) {
std::string::size_type m{}, n{};
while (true) {
n = s.find(delim, m);
f(s.substr(m, n - m));
if (n == std::string::npos) {
break;
}
View polymorphism.go
import "fmt"
type Other struct {
c bool
x, y int
}
type Model interface{}
type A struct {
@inhzus
inhzus / channel.go
Created Jul 11, 2019
Passing channel over channel to do request & get response
View channel.go
package main
import "fmt"
var queue = make(chan int)
var c = make(chan chan error)
func request() {
for i := 0; i < 4; i++ {
queue <- i
View main.py
import argparse
from . import user_service, doc_service, repo_service
parser = argparse.ArgumentParser()
# ... set argument
args = parser.parse_args()
print(getattr(
globals()[f'{args.sub}_service'],
getattr(args, args.sub))
@inhzus
inhzus / edge_linking.m
Created Apr 30, 2019
Inner boundary tracing
View edge_linking.m
function output = my_edgelinking(image, row, col)
output = [row col;];
image(row, col) = 0;
dir = 7;
while (1)
[row, col, next_found, dir] = find_next_dir(row, col, dir, image);
if (~next_found)
break;
end
@inhzus
inhzus / edge_detection.m
Created Apr 30, 2019
Canny edge dection
View edge_detection.m
function output = my_edge(input_image)
mean_value = mean(mean(input_image));
[height, width] = size(input_image);
fft_mid_img = fftshift(fft2(input_image));
fft_ratio = 12;
a = round(height/fft_ratio):round((fft_ratio-1)*height/fft_ratio);
b = round(width/fft_ratio):round((fft_ratio-1)*width/fft_ratio);
% disp(a);
% disp(b);
fft_mid_img(round(height / 2), round(width / 2)) = 0;
@inhzus
inhzus / fp_growth.py
Created Apr 22, 2019
Frequent itemsets algorithm: FP-Growth
View fp_growth.py
# -*- coding: utf-8 -*-
# created by inhzus
import typing
from collections import Counter, defaultdict
from itertools import combinations
from pprint import pprint
T = typing.TypeVar('T')
@inhzus
inhzus / apriori.py
Created Apr 22, 2019
Frequent itemsets Algorithm: Apriori
View apriori.py
# -*- coding: utf-8 -*-
# created by inhzus
import typing
from collections import defaultdict
from itertools import combinations
from numbers import Number
from pprint import pprint
from bitarray import bitarray
@inhzus
inhzus / Histogram_equalization.m
Created Mar 13, 2019
Histogram equalization, RGB and HSV
View Histogram_equalization.m
function [output] = Histogram_equalization(input_image)
%first test the image is a RGB or gray image
hsv = true;
if numel(size(input_image)) == 3
%this is a RGB image
%here is just one method, if you have other ways to do the
%equalization, you can change the following code
if hsv
input_image = rgb2hsv(input_image);
h=input_image(:,:,1);
@inhzus
inhzus / Branch. cpp
Last active Feb 16, 2019
document tracker gist
View Branch. cpp
class Branch {
Date time;
unsigned index;
unsigned succ;
string comment;
}
You can’t perform that action at this time.