Skip to content

Instantly share code, notes, and snippets.

View aagontuk's full-sized avatar

Ashfaqur Rahaman aagontuk

View GitHub Profile
@aagontuk
aagontuk / red-black-tree.c
Last active October 17, 2022 05:53
A RED-BLACK TREE Implementation
/*
* [PROG] : Red Black Tree
* [AUTHOR] : Ashfaqur Rahman <sajib.finix@gmail.com>
* [PURPOSE] : Red-Black tree is an algorithm for creating a balanced
* binary search tree data structure. Implementing a red-balck tree
* data structure is the purpose of this program.
*
* [DESCRIPTION] : Its almost like the normal binary search tree data structure. But
* for keeping the tree balanced an extra color field is introduced to each node.
* This tree will mantain bellow properties.
@aagontuk
aagontuk / ls-clone-attempt.c
Created June 17, 2016 10:15
My Unix ls command clone attempt
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <time.h>
#include <string.h>
/* Serial Port Programming
* Base on the tutorial from
* http://xanthium.in/Serial-Port-Programming-on-Linux
*/
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
@aagontuk
aagontuk / digitrec.py
Last active December 12, 2017 10:49
Canny edge detection
import cv2
import numpy as np
img = cv2.imread(example.jpg)
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
blurred = cv2.GaussianBlur(imgGray, (5, 5), 0)
imgCanny = cv2.Canny(blurred, 50, 80)
cv2.namedWindow('Canny Edge', cv2.WINDOW_NORMAL)
@aagontuk
aagontuk / save_universe.py
Created April 9, 2018 19:13
Saving the universe again - cj2018 problem 1
def flip(s):
sz = len(s)
flip = 0
for i in xrange(0, sz - 1):
if s[i] == 'C' and s[i + 1] == 'S':
s[i], s[i + 1] = 'S', 'C'
flip = 1
break
@aagontuk
aagontuk / save_universe.py
Created April 9, 2018 19:13
Saving the universe again - cj2018 problem 1
def flip(s):
sz = len(s)
flip = 0
for i in xrange(0, sz - 1):
if s[i] == 'C' and s[i + 1] == 'S':
s[i], s[i + 1] = 'S', 'C'
flip = 1
break
@aagontuk
aagontuk / .vimrc
Last active January 27, 2020 08:28
My ~/.vimrc - RAW: tiny.cc/sfinix-vim
" required for Vundle
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'Valloric/YouCompleteMe'
Plugin 'ajmwagar/vim-deus'
@aagontuk
aagontuk / noaa_downloader.py
Last active July 31, 2022 19:37
Script for downloading files from NOAA FTP links
#!/usr/bin/env python3
# Script for downloading files from NOAA ftp server and do necessary
# cleanups.
import os
import argparse
from ftplib import FTP
import tarfile
import glob
@aagontuk
aagontuk / client.c
Last active December 3, 2023 17:15
Simple server-client communication example in C
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_DATA_LEN 8192
@aagontuk
aagontuk / .zshrc
Last active November 25, 2019 09:20
My ~/.zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/home/sfinix/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes