Skip to content

Instantly share code, notes, and snippets.

View bguo068's full-sized avatar

Bing Guo bguo068

  • University of Maryland School of Medicine
  • MD, USA
View GitHub Profile
@HViktorTsoi
HViktorTsoi / Argsort.cpp
Created June 21, 2020 07:23
C++ STL implementation of Argsort
#include <vector>
#include <algorithm>
/**
* Argsort(currently support ascending sort)
* @tparam T array element type
* @param array input array
* @return indices w.r.t sorted array
*/
template<typename T>
@Vini2
Vini2 / Visualise_Graph_Demo.ipynb
Last active September 23, 2021 07:47
Visualising Graph Data with python-igraph
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@elowy01
elowy01 / BCFtools cheat sheet
Last active October 17, 2024 17:30
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

X11 Forwarding using an SSH Reverse Tunnel

X11 Forwarding is very useful when you want to run GUI based applications on a remote machine. I needed it to run IntelliJ IDE on HPC. But while X11 forwarding can be easily enabled using the -X (or -Y) option of ssh, it doesn't work if xauth is not installed on the remote server - in my case the HPC compute nodes. In this case, ssh can be used to create a reverse tunnel from the remote server to the local machine. X11Forwarding can then be done by setting the display on the remote server as the entry port of the tunnel and making the X-server listen on the exit port of the tunnel in the local machine.

Here I'll describe how I went about creating a SSH reverse tunnel from HPC compute nodes to my local machine and used that to enable X11 Forwarding. As a prerequisite, I assume that a Display Manager that launches the X-server is installed on the local machine. Popular ones are XQuartz for macOS and XMing for Windows.

  1. Enable X11 forwarding on local machine.
@gravitylow
gravitylow / codesign_gdb.md
Last active October 23, 2024 09:17 — forked from hlissner/codesign_gdb.md
Codesign gdb on macOS

If you are getting this in gdb on macOS while trying to run a program:

Unable to find Mach task port for process-id 57573: (os/kern) failure (0x5).
 (please check gdb is codesigned - see taskgated(8))
  1. Open Keychain Access
  2. In menu, open Keychain Access > Certificate Assistant > Create a certificate
  3. Give it a name (e.g. gdbc)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.