Install Python3 on linux

June 28, 2017 § Leave a comment

Remove Duplicate Files in python

June 21, 2017 § Leave a comment

How it works?

the program takes the file path from user, then calculates its sha-256 hash, then takes the folder path from user to search in and start search for files with the same sha-256.

Installation:

  1. install python 3.x from here
  2. create a new .py file and copy the source code into it.
  3. run script.

*NOTE: ‘the folder path not included sub-folders’.

if you want to contribute, fork it.

Follow me on github

How Dropbox Knows When You’re Sharing Copyrighted Stuff?

May 31, 2017 § Leave a comment

Hashing.
Before i dive in:

‘A’ is a criminal, he wants to rob a bank so he asked his friends ‘B’ and ‘C’ for help. They robbed the bank successfully but unfortunately ‘B’ had forgotten his gloves at home before the crime. The police officer got his fingerprint and after a few days from fingerprint matching, the police catch’em all.
Same thing for files, every tiny file has its unique fingerprint from characters and numbers like “ah4213jn234bmn53b” and even if you change the location or name or things like that the fingerprint not change at all – if you wanna see install this https://support.microsoft.com/en-us/help/841290/availability-and-description-of-the-file-checksum-integrity-verifier-utility and have little fun – The dropbox has a big table with the fingerprints of the origin files and when you upload a file, a hash is generated and if its fingerprint exist the site blocked the uploaded one.

It’s the same idea to store your password and username.
Follow me on quora

ABCD * D = DCBA (Puzzle+Solution)

April 7, 2017 § Leave a comment

The Puzzle

“ABCD * D = DCBA”, Replace every character with a number to make the equation mathematically right.

The Solution using brute-force algorithm

#include<bits/stdc++.h>
using namespace std;
int main(){
    for(int a=0;a<=9;a++){
        for(int b=0;b<=9;b++)if(a!=b){
            for(int c=0;c<=9;c++)if(a!=c && b!=c){
                for(int d=0;d<=9;d++)if(a!=d && b!=d && c!=d){
                        if((a*1000+b*100+c*10+d)*d == (d*1000+c*100+b*10+a))
                            return cout<<"abcd\n"<<a<<b<<c<<d,0;
                }
            }
        }
    }

    return 0;
}

The final answer is 1089.

The 6th number is both square and triangular [Puzzle]

March 28, 2017 § Leave a comment

 

My Review > Grokking Algorithms An illustrated guide for programmers and other curious people

March 23, 2017 § Leave a comment

Grokking Algorithms An illustrated guide for programmers and other curious peopleGrokking Algorithms An illustrated guide for programmers and other curious people by Aditya Y. Bhargava

My rating: 4 of 5 stars

To me, This book have two sections first from chapter 1 to chapter 10,and the second and i mostly liked is the chapter 11 “Where to go next” but the book in general very useful for beginners.

minn

View all my reviews

Install atom packages on windows

February 16, 2017 § Leave a comment

Assalamu Alaikum everyone 😀 ,
If you’re using atom this article will help you install its packages on windows.First things first, go to https://atom.io/packages and search for the package you want to install, in this article i want to install “turbo-javascript” package.

Install packages using GUI:

Open atom -> Packages -> settings view -> install packages/themes
in the search box write “turbo-javascript” without double quotes (or any package you want) then click install. DONE

This slideshow requires JavaScript.

Install packages using CMD:

Open cmd then write:

cd c:\users\pcName\.atom

then

apm //stands for Atom Package Manager
//&lt; and &gt; stands for less than and greater
apm install &lt;turbo-javascript&gt; //replace turbo-javascript with your package's name

you’ll see script like this (without the last line)

atom3

Solution – 330A – Cakeminator – codeforces

April 8, 2016 § Leave a comment

//c++
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int r,c;
    cin>>r>>c;
    char arr[11][11];
    for(int i=0 ; i<r ; i++)
    {
        for(int j=0 ; j<c ; j++)         {             cin>>arr[i][j];
        }
    }
    int co=0; //how many dots
    int res1=0; //1stpart
    int re=0; //how many repeat
    for(int i=0 ; i<r ; i++)
    {
        co=0;
        bool repeat=false; //repeat or not
        for(int j=0 ; j<c ; j++)
        {
            if(arr[i][j]=='.')
                {co++;}
        }

        if(co==c && repeat==true)
            {res1=co-1+res1; repeat=true; re++;}
        else if(co==c)
            {res1=co+res1; repeat=true; re++;}
    }
    int res=0; //2ndpart
    for(int i=0 ; i<c ; i++)
    {
        co=0;
        bool repeat=false; //repeat or not
        for(int j=0 ; j<r ; j++)
        {
            if(arr[j][i]=='.')
                co++;
        }
        if(co==r)
            {res=co-re+res; repeat=true;}
    }
    cout<<res+res1;
}

Find more from my submissions HERE

Solution – 31A – Worms Evolution – codeforces

April 3, 2016 § Leave a comment

//c++
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,arr[1001],x,y;
    cin>>n;
    for(int i=0 ; i<n ; i++)
        cin>>arr[i];
    for(int i=0 ; i<n ; i++)
    {
        for(int j=i+1 ; j<n ;j++)
        {
            x=arr[i]+arr[j];
            y=abs(arr[i]+arr[j]);
            for(int z=0 ; z<n ; z++)
            {
                if(x==arr[z])
                {cout<<z+1<<" "<<j+1<<" "<<i+1; return 0;}
                if(y==arr[z])
                {cout<<z+1<<" "<<j+1<<" "<<i+1; return 0;}
            }

        }
    }
    cout<<"-1"<<endl;
    return 0;

}

Find more from my submissions HERE

Where Am I?

You are currently browsing the Programming category at Orange Notes.

%d bloggers like this: