Skip to content

Instantly share code, notes, and snippets.

View sm2774us's full-sized avatar

Shaikat Majumdar sm2774us

View GitHub Profile
@sm2774us
sm2774us / Codility_Solutions_In_Java.md
Created September 10, 2023 03:10
Codility Solutions in Java

#Binary Gap

class Solution {
	public int solution2(int n) { 
		// get rid of right-hand zeros
	    while (n != 0 && (n & 1) == 0) {
	        n >>>= 1;
	    }
	    System.out.println("n--->"+n);
	    
@sm2774us
sm2774us / whiteboardCleaner.md
Created January 25, 2021 02:50 — forked from lelandbatey/whiteboardCleaner.md
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@sm2774us
sm2774us / create_new_github_repo.sh
Created January 22, 2019 17:23
CURL command to create NEW github repo
curl -i -H "Authorization: token ${GITHUB_TOKEN}" -d '{"name": "Artificial_Intelligence", "auto_init": true, "private": true, "gitignore_template": "nanoc"}' https://api.github.com/user/repos
@sm2774us
sm2774us / commit_git_repos.sh
Created January 22, 2019 16:53
Commit all git repositories under a base directory
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mCommitting all the latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
@sm2774us
sm2774us / update_git_repos.sh
Created January 22, 2019 16:32
Update all git repositories under a base directory
#!/bin/bash
# store the current dir
CUR_DIR=$(pwd)
# Let the person running the script know what's going on.
echo "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all git repositories and update it to the master latest revision
for i in $(find . -name ".git" | cut -c 3-); do
@sm2774us
sm2774us / download_all_github_repositories.sh
Created January 22, 2019 16:28
Bash Script to clone all repos at once from GitHub for a particular user
#!/bin/bash
#Name : download_all_github_repositories.sh
#Description : Clone all repos at once from GitHub for a particular user.
#Example : ./download_all_github_repositories.sh sm2774us [ Clone all repos for the user 'sm2774us' ]
#name="sm2774us"
access_token="63f41db90871183d7fc8cb3626a7d6bd9895d910"
if [ -z "$1" ]; then
#echo "waiting for the following arguments: username + max-page-number"