Skip to content

Instantly share code, notes, and snippets.

View MAHRahat's full-sized avatar

Md. Ashraful Haq Rahat MAHRahat

  • Bangladesh Space Research and Remote Sensing Organization
  • Dhaka, Bangladesh
  • 03:18 (UTC +06:00)
  • LinkedIn in/MAHRahat
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@MAHRahat
MAHRahat / revert-a-commit.md
Created July 29, 2021 11:31 — forked from gunjanpatel/revert-a-commit.md
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}'

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@MAHRahat
MAHRahat / gist:a33e50b7eee052ea1cc6f780e467b75f
Created July 29, 2021 11:26 — forked from CrookedNumber/gist:8964442
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

@MAHRahat
MAHRahat / 0fixup.md
Created July 29, 2021 11:24 — forked from silent1mezzo/0fixup.md
On undoing, fixing, or removing commits in git

A git choose-your-own-adventure!

This document is an attempt to be a fairly comprehensive guide to recovering from what you did not mean to do when using git. It isn't that git is so complicated that you need a large document to take care or your particular problem, it is more that the set of things that you might have done is so large that different techniques are needed depending on exactly what you have done and what you want to have happen.

http://docs.oracle.com/cd/E13222_01/wls/docs92/webapp/basics.html
http://docs.roguewave.com/hydraexpress/3.5.0/html/rwsfservletug/4-7.html
http://javabeat.net/spring-mvc-application-context/
http://www.programcreek.com/
https://netbeans.org/kb/docs/javaee/ecommerce/intro.html#about
https://docs.jboss.org/author/display/JBWS/Web+Services+Introduction
http://www.javatips.net/
http://www.sanfoundry.com/
@MAHRahat
MAHRahat / Sanfoundry-mcq-extractor.py
Created July 13, 2021 10:39 — forked from innovatorved/Sanfoundry-mcq-extractor.py
Extract MCQ Questions of Specific topic from sanfoundry.com Web Scrapping
#!/usr/bin/env python3
__author__ = "Ved Prakash Gupta"
__copyright__ = f"Copyright (C) 2021 {__author__}"
__license__ = "Public Domain"
__version__ = "1.0"
from bs4 import BeautifulSoup
import requests
import sys

Steps

  1. Data Collection - Data Preperation - EDA - Machine Learning - Visualization

Machine Learning vs Statistics

  1. Hypothesis testing, Experimental design / Computational modeling, high dimensionality spaces
  2. Anova, Linear regression, Logistic regression, GLM, PCA / SVM, NN, ANN, Decision trees, RF, Visualization

Learning approaches

  1. Supervised: Labeled dataset ==> Find clusters in the populations, fruits, species
  2. Unsupervised: Unlabeled dataset
import tensorflow as tf
import numpy as np
import pandas as pd
from sklearn.datasets import load_boston
import matplotlib.pyplot as plt
boston=load_boston()
type(boston)
boston.feature_names
#pickle dict with image in Python2 (2.7.6 used)
frame = cv2.imread('input.jpg')
img_str = cv2.imencode('.jpg', frame)[1].tostring()
data = {'img': img_str}
with open('pickledObj.pkl', 'wb') as outfile:
pickle.dump(data, outfile)
# unpickle in Python3 (Python 3.4.3 used for testing) using encoding=latin1
with open('pickledObj.pkl', 'rb') as f:
data_dict = pickle.load(f, encoding='latin1')
@MAHRahat
MAHRahat / python_quick_tips.ipynb
Created June 24, 2021 17:53 — forked from sreeragh-ar/python_quick_tips.ipynb
Python_quick_tips.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.