Skip to content

Instantly share code, notes, and snippets.

View tuttelikz's full-sized avatar
🔨
生き甲斐

San Askaruly tuttelikz

🔨
生き甲斐
View GitHub Profile
@tuttelikz
tuttelikz / NaiveBayes.py
Last active June 25, 2023 16:03
Naive Bayes From Scratch in Python
#How To Implement Naive Bayes From Scratch in Python
#http://machinelearningmastery.com/naive-bayes-classifier-scratch-python/
#Dataset
#https://archive.ics.uci.edu/ml/machine-learning-databases/pima-indians-diabetes/pima-indians-diabetes.data
import csv
import math
import random
#Handle data
@tuttelikz
tuttelikz / Histogram Equalization OpenCV C++
Created September 21, 2016 08:09
This Gist gives a code snippet for histogram equalization in OpenCV. In line 63, you should enter your source image name
#include <iostream>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace std;
using namespace cv;
//function to take histogram of input image
void imageHistogram(Mat image, int histogram[]) {
// initialize all intensity values to 0
@tuttelikz
tuttelikz / bilateral_filter.m
Created May 6, 2017 00:07
Bilateral Filter - MATLAB
clc, close all, clear all;
img = imread('puppy.jpg');
A = rgb2gray(img);
[m,n] = size(A);
%Filter Parameters setup
windowSize = input('Enter window size (3/5/7):\n ');
stDevSpace = input('Enter space standard deviation (1-20):\n ');
@tuttelikz
tuttelikz / Rename_files.txt
Created January 4, 2018 09:44
Rename filename bash
num=0; for i in *; do mv "$i" "$(printf '%04d' $num).${i#*.}"; ((num++)); done
@tuttelikz
tuttelikz / add_prefix_to_filename.txt
Created January 18, 2018 12:35
Bash command for adding prefix
for f in * ; do mv "$f" "PRE_$f" ; done
@tuttelikz
tuttelikz / write_labels_tofile.py
Created January 18, 2018 13:00
This is a python script to write list characters into file
thefile = open('train_test_data_labels.txt', 'w')
for item in y_train_test_list:
thefile.write("%s\n" % item)
@tuttelikz
tuttelikz / read_labels_fromfile.py
Created January 18, 2018 13:40
This is a simple script to read labels from file
array = []
with open('train_test_data_labels.txt') as fileobj:
for line in fileobj:
for ch in line:
array.append(ch)
#print(ch)
new_list = [a for a in array if a != '\n']
@tuttelikz
tuttelikz / copy_folders_without_contents
Created January 20, 2018 02:49
This is a bash command on windows to copy folders structure without contents
xcopy C:\Folders D:\Folders /t /e
# After installation of PuTTY, open command window prompt and type the following:
//For copying folder:
pscp -r source destination
//For copying file:
pscp source destination
@tuttelikz
tuttelikz / run_multiple_script_command
Created January 20, 2018 04:50
For running multiple bash commands
#This is an example how to run multiple bash commands together
# Just put && symbol between commands
cd o_cheek/ && num=0; for i in *; do mv "$i" "$(printf 'cheek_old_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv o_cheek cheek_old && cd o_eye/ && num=0; for i in *; do mv "$i" "$(printf 'eye_old_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv o_eye eye_old && cd o_forearm/ && num=0; for i in *; do mv "$i" "$(printf 'forearm_old_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv o_forearm forearm_old && cd y_cheek/ && num=0; for i in *; do mv "$i" "$(printf 'cheek_young_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv y_cheek cheek_young && cd y_eye/ && num=0; for i in *; do mv "$i" "$(printf 'eye_young_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv y_eye eye_young && cd y_forearm/ && num=0; for i in *; do mv "$i" "$(printf 'forearm_young_%04d' $num).${i#*.}"; ((num++)); done && cd .. && mv y_forearm forearm_young