Skip to content

Instantly share code, notes, and snippets.

@anchal-physics
anchal-physics / MoveFilesAcrossGitReposKeepingHistory.md
Created February 2, 2021 00:09
For the purpose of reorganization, sometimes we have to move files tracked by git in a repo to another repo. If you simply copy the file, in the new repo it would only appear as a new file. Ideally, you should copy the file along with its version history. Here are the instructions on how to do that.

Moving files across git repositories keeping version history.

Setting:

You have a git repo name 'repoA' which containes some files that you want to move to another repo named 'repoB' keeping their version history. You would need git filter-repo so install it. DO NOT USE git filter-branch on any other instruction set which asks you to use it.

pip install git-filter-repo

Commands:

  • Create a temporary local directory where we'll do the juggling. Later, we'll delete it.
@anchal-physics
anchal-physics / environment-modules_absent.md
Last active July 18, 2023 18:03
If on login, one sees the message: "-bash: /usr/share/modules/init/bash: No such file or directory", then it probably means that your environment-modules package is corrupted or missing.

How to resolve error:

-bash: /usr/share/modules/init/bash: No such file or directory

This means that enviornment-modules package was installed in your system and got removed improperly somehow with /etc/profile/modules.sh still calling for it on login to setup shell environment. There is a easy fix to this:

sudo apt-get install environment-modules
@anchal-physics
anchal-physics / DataRecoveryFromAComputerThatDoesNotBoot.md
Last active May 15, 2020 17:50
This is a central documentation for data recovery from a computer using free and open source tools.

Data Recovery from a computer (any OS/architecture) that won't boot

1. Create a debian-live bootable USB stick

  • Download the portable version of Etcher
  • Download iso image of Debian-live. For a 64-bit PC, I recommend using this debian-live-10.4.0-amd64-xfce.iso which comes with lightweigth xfce desktop environment.
  • Run Etcher with your usb stick plugged in, select the downloaded .iso image and just use recommended default setttings.

2. Data Recovery

  • Plug the live bootable usb stick to your sick computer.
  • Switch the computer on with Option/alt(⌥) key pressed for mac or F2/F10/F12 for windows/linux computers.
@anchal-physics
anchal-physics / a_tmuxmuxReadMe.md
Created April 30, 2020 18:02
Here I provide a useful bash function tmuxmux() which is kind of a wrapper for other functions I write. IN particular, it is useful are making commands that will launch something that requires an open terminal (e.g. jupyter notebook). When opened with tmuxmux, a new tmux session is created in detached mode. In case you are calling a same functio…

Set functions to open programs silently in tmux sessions

1. Install tmux

  • On linux:
sudo apt-get install tmux
  • On mac:
brew install tmux
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anchal-physics
anchal-physics / LIGOconda.yml
Created April 29, 2020 22:18
Conda environment with LIGO relevant packages. Install using conda env create -f LIGOconda.yml.
name: LIGO
channels:
- conda-forge
- defaults
dependencies:
- _libgcc_mutex=0.1=main
- asn1crypto=1.3.0=py38_0
- astropy=4.0.1.post1=py38h7b6447c_0
- attrs=19.3.0=py_0
- backcall=0.1.0=py38_0
@anchal-physics
anchal-physics / SetupDebianWSLwithCondaOnWindows.md
Last active April 30, 2020 15:58
We find it often that summer intern students use windows machine to work. This creates a problem for them to follow guidelines and steps in most of the labs resources which are meant for linux systems. Here is a quick guide on how to install Windows Subsystem Linux with Debian on your windows machine and get started with using linux features. Th…

Setup Debian WSL on Windows machine to use Linux features and nds2

1. Install WSL

  • Instruction source.
  • Search "Windows PowerShell" on windows search bar, right click on "Windows Powershell" and click on "Run as Administrator". Click ok on the permissions prompt. In the powershell, do:
PS C:\Windows\system32> Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
  • It will ask you to restart your computer. Do that.
@anchal-physics
anchal-physics / SetupTravisAndDeploy.md
Last active October 12, 2022 03:34
Instructions to setup travis for automatic compiling and deployment. The instructions are meant for compiling latex, but could be used for compiling other source codes as well. This is a minimal description to streamline the process. I would recommend reading instructions from http://travis-ci.com itself for full understanding.

Setup Travis for automatic latex compilation and deployment

1. Add a MakeFile in your source code folder

First, create a MakeFile for your code and ensure you can compile locally using the command make. Following is a minimal MakeFile to compile pdf using latexmk:

.PHONY: all
all: TexFile1NameWithoutExtension TexFile2NameWithoutExtension

TexFile1NameWithoutExtension: %: %.tex
	latexmk -f -pdf $@