Skip to content

Instantly share code, notes, and snippets.

View subodh-malgonde's full-sized avatar

Subodh Malgonde subodh-malgonde

View GitHub Profile
@subodh-malgonde
subodh-malgonde / delete_git_submodule.md
Last active October 23, 2018 07:17 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

# Remove the submodule entry from .git/config
git submodule deinit -f path/to/submodule

# Remove the submodule directory from the superproject's .git/modules directory
rm -rf .git/modules/path/to/submodule

# Remove the entry in .gitmodules and remove the submodule directory located at path/to/submodule
@subodh-malgonde
subodh-malgonde / tmux-cheatsheet.markdown
Created September 24, 2018 09:36 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@subodh-malgonde
subodh-malgonde / transfer_learning.MD
Last active December 31, 2021 10:03
Transfer learning in Tensorflow

Assumptions

  1. We have a pre-trained network and want to perform transfer learning using it.

  2. Lets say we keep initial 5 layers from the pre-trained network and add our own layers on top of it.

  3. Output of layer number 5 was given the name "layer5_out" when building the network

  4. We can perform transfer learning on this in 2 ways:

    1. Initialize the first 5 layers using the weights of the pre-trained network and freeze them during training.
    2. Initialize the first 5 layers using the weights of the pre-trained network and train them i.e. update them during training.
    
EventBus.getDefault().post(new AddToCartEvent(productObject));
public class MyDatabaseHelper{
public MyDatabaseHelper(){
EventBus.getDefault().register(this);
}
// To register an async event handler you need to define onEventAsync or onEventBackgroundThread
// Here we will use onEventBackgroundThread, please check EventBus' docs for more details.
public void onEventBackgroundThread(AddToCartEvent event){
Product product = event.getProduct();
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//register with the event bus
EventBus.getDefault().register(this);
// other code goes here
}
public class AddToCartEvent{
private Product product;
public AddToCartEvent(Product product){
this.product = product;
}
public Product getProduct(){
return product;
}
@subodh-malgonde
subodh-malgonde / activity_fragment_comm.java
Created December 9, 2015 11:14
Boilerplate introduced by activity to fragment communication in the Android framework
FragmentManager fragmentManager = getFragmentManager();
FragmentA fragmentA = (FragmentA) fragmentManager.findFragmentByTag(FragmentA.TAG);
if(fragmentA != null && fragmentA.isAdded()){
fragmentA.foo()
}
@subodh-malgonde
subodh-malgonde / interface_listener_boilerplate.java
Last active December 9, 2015 11:17
Illustration of boilerplate introduced by the interface-listener pattern used in Android apps to communication between fragment & activity
public class FragmentA extends Fragment{
OnFragmentInteractionListener listener;
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
listener = (OnFragmentInteractionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener");