Skip to content

Instantly share code, notes, and snippets.

View cbp44's full-sized avatar

cbp44-prenetics cbp44

View GitHub Profile
@cbp44
cbp44 / ncbi_refseq_select_bed12.md
Last active November 17, 2021 04:18
Create NCBI RefSeq Select BED12 file

Create NCBI RefSeq Select BED12 file

This gist shows you how to create a BED file in BED12 format containing every protein-coding NCBI RefSeq Select gene with the exons annotated as blocks in the BED file.

  1. First, download a TSV file of NCBI RefSeq Select genes
    1. Go to the UCSC Table Browser
    2. Select these parameters
      • Assembly: Dec. 2013 (GRCh38/hg38)
      • Group: Genes and Gene Predictions
      • Track: NCBI RefSeq
@cbp44
cbp44 / unbound-filter-update
Last active October 20, 2021 05:30
Unbound DNS block list cronjob
#!/bin/sh
# This script updates malware and phishing filters for unbound DNS resolver
# To use it, place in /etc/cron.daily/unbound-filter-update and chmod 0755 /etc/cron.daily/unbound-filter-update
# Get filter of potentially unwanted programs (PUPs)
get_pup_filter() {
echo "server:"
/usr/bin/curl -L "https://curben.gitlab.io/malware-filter/pup-filter-unbound.conf" | /usr/bin/grep -v "?"
}
@cbp44
cbp44 / random_windows_hostname.md
Last active October 6, 2023 09:51
Random Windows hostname generator

Random Windows Hostname from Linux Shell

Shell function one-liner to produce a pseudorandom hostname in the style of Windows 7, Windows 8 and Windows 10 e.g. DESKTOP-V1XZZQ3

random_windows_hostname() {
    printf "DESKTOP-$(/usr/bin/tr -dc A-Z0-9 </dev/urandom | /usr/bin/head -c 7)"
}
echo "$(random_windows_hostname)"   # produces DESKTOP-V1XZZQ3
@cbp44
cbp44 / secure_ufw.sh
Last active October 20, 2021 05:25
Lock down ufw firewall
#!/bin/bash
set -uo pipefail
# ufw_allow_out PROTOCOL [INTERFACE]
#
# Allows outbound traffic using ufw to the given PROTOCOL on INTERFACE (optional, any by default).
#
# PROTOCOL - the network protocol to allow out, supported: dns, ftp, ftps, ntp, nts, ssh, web
# INTERFACE - the interface to allow traffic out on, default: any
#
@cbp44
cbp44 / gtf_to_tss_bed.sh
Last active September 14, 2023 07:49
Convert GTF to TSS BED file
#!/bin/sh
# Creates a sorted BED file with all transcript TSS locations with the Ensembl transcript id for the name column
# This script does this for the Mouse vM19 annotaions, but should work just fine with Human GTF as well
wget ftp://ftp.ebi.ac.uk/pub/databases/gencode/Gencode_mouse/release_M19/gencode.vM19.annotation.gtf.gz
zcat gencode.vM19.annotation.gtf.gz | awk 'OFS="\t" {if ($3=="transcript") {if ($7 == "+") {print $1,$4-1,$4,$12,".",$7} else {print $1,$5-1,$5,$12,".",$7}}}' | tr -d '";' | sort -k1,1V -k2,2n > gencode.vM19.annotation.tss.bed