Skip to content

Instantly share code, notes, and snippets.

View arupgsh's full-sized avatar
:octocat:

Arup Ghosh arupgsh

:octocat:
View GitHub Profile
@arupgsh
arupgsh / chmod-400.cmd
Created April 7, 2024 18:05 — forked from jaskiratr/chmod-400.cmd
Set permission of file equivalent to chmod 400 on Windows.
# Source: https://stackoverflow.com/a/43317244
$path = ".\aws-ec2-key.pem"
# Reset to remove explict permissions
icacls.exe $path /reset
# Give current user explicit read-permission
icacls.exe $path /GRANT:R "$($env:USERNAME):(R)"
# Disable inheritance and remove inherited permissions
icacls.exe $path /inheritance:r
@arupgsh
arupgsh / BCFtools cheat sheet
Created June 15, 2023 18:19 — forked from elowy01/BCFtools cheat sheet
BCFtools cheat sheet
*bcftools filter
*Filter variants per region (in this example, print out only variants mapped to chr1 and chr2)
qbcftools filter -r1,2 ALL.chip.omni_broad_sanger_combined.20140818.snps.genotypes.hg38.vcf.gz
*printing out info for only 2 samples:
bcftools view -s NA20818,NA20819 filename.vcf.gz
*printing stats only for variants passing the filter:
bcftools view -f PASS filename.vcf.gz
@arupgsh
arupgsh / backup_remote_server.sh
Created February 21, 2023 19:02
A script to create and trasfer server (webapps) backups to remote storage server.
#!/bin/bash
# exit when any command fails
set -e
#get start time for calculating time taken to complete the process
start=$(date +%s)
#source location, backup location and archive names
SRCDIR="/var/www/html/"
@arupgsh
arupgsh / powershell-sshcopyid.md
Last active November 9, 2021 19:10
PowerShell SSH-COPY-ID allternative
#!/usr/bin/python3 env
# -*- coding: utf-8 -*-
"""Qsub command generator
Author: Arup Ghosh
Creation date: 17/07/2019
last modified: 18/07/2019
Email: email [at] gmail.com
"""
import glob
@arupgsh
arupgsh / netplan_dual_nic.yaml
Last active October 27, 2021 10:45
Netplan routing configuration (IPV4) for dual networking interfaces, with one having access to internet other only accessible via local network. This has been tested in Ubuntu server 20.04 and for some reason netplan apply works although netplan try is not working.
# Last update 27-10-2021
# network scheme was create using https://netplan.io/reference/
# The following configuration assumes the first interface has internet access
# CIDR calculator https://mxtoolbox.com/subnetcalculator.aspx
network:
ethernets:
eno1:
addresses:
- xxx.xxx.xxx.xxx/24 #IPV4 address for interface 1
routes:
@arupgsh
arupgsh / pubmed_search.py
Last active May 22, 2021 15:38
Get_PMIDs
from Bio import Entrez
Entrez.email = "yourmail@gmail.com"
handle = Entrez.esearch(db="pubmed", term="cancer", retmax="10", sort="relevance", retmode="xml")
records = Entrez.read(handle)
print records["IdList"]
## If you are facing timeout [Error 12] with official repository
## Check the commans before running as root
#sudo yum remove docker docker-client docker-client-latest docker-common docker-latest docker-latest-logrotate docker-logrotate docker-engine # remove previous version
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#yum list docker-ce --showduplicates | sort -r #List all available docker versions
#!/bin/bash
###################################################################
#Script Name : Nanoclust Demo
#Description : NanoCLUST installation test for Centos 7
#Author : Arup Ghosh
#Web : https://arup.dev
###################################################################
set -e
#' Find Variable genes using a negative binomial null model
#' cut.quantile - quantile ceiling on max counts
# source: https://github.com/karthikshekhar/CellTypeMIMB
NB.var.genes <- function(
object = object,
cells.use=NULL,
min.cells = 200,
do.idents=NULL,
genes.use = NULL,
do.plot=TRUE,