Skip to content

Instantly share code, notes, and snippets.

View disulfidebond's full-sized avatar

disulfidebond disulfidebond

  • UWisconsin-Madison
  • Madison, WI
View GitHub Profile
@disulfidebond
disulfidebond / create_restore_dmg_macosx.md
Last active January 20, 2025 21:25
Create or Restore Disk Image in Mac OSX

Overview

This gist details how to create or restore a disk image in Mac OSX. There are three methods that are described: Carbon Copy Cloner, Disk Utility, and CommandLine.

  • Disclaimer:
    • I have no financial incentives to https://bombich.com or Apple.
    • Always make a backup of your data, and make 2 separate backups before trying something new.
    • The following steps have been tested and are a summary of my personal recommendations, but should be used at your own risk.
    • If there is a chance of imminent data loss, contact a professional for assistance, and do not rely on a random person from the Internet for help.

Method 1: Carbon Copy Cloner (CCC)

@disulfidebond
disulfidebond / timestamp-bash.sh
Created January 25, 2019 18:22 — forked from scienceystuff/timestamp-bash.sh
timestamp in bash
#!/bin/sh
date
# outputs Fri Jan 25 12:10:33 CST 2019
# alternative: add to bash_profile
timestamp() {
date +"%T"
}
@disulfidebond
disulfidebond / timestamp-py.py
Created January 25, 2019 18:22 — forked from scienceystuff/timestamp-py.py
timestamp in python
import time
import datetime
# credit: squiguy https://stackoverflow.com/a/13891070
t_stamp = time.time()
t_stamp_string = datetime.datetime.fromtimestamp(t_stamp).strftime('%Y-%m-%d %H:%M:%S')
# output: 2019-01-25 12:06:02
t_stamp_string = datetime.datetime.fromtimestamp(t_stamp).strftime('%Y.%m.%d.%H.%M.%S')
# output: 2019.01.25.12.07.16
@disulfidebond
disulfidebond / Mac_OSX_keychain_options_commandline.md
Created October 6, 2018 21:39
Mac OSX keychain options when using commandline

Unlock Keychain

  • Explanation: this can be used to remotely (or within a Terminal session) to unlock keychain
  • Requirements/Restrictions:
    • You must know the keychain password
    • This is confirmed to work on Mac OSX High Sierra, but may have different usage on other Mac OSX versions (Sierra, Mojave, etc)
  • Cautions/Warnings:
    • This will unlock your keychain, which is a potential security risk that you may not want to happen.

      # command to use in Bash, will prompt for the password
      

If no keychain is specified, then the default will be used

@disulfidebond
disulfidebond / parse_mhc_workflow_pt3.md
Last active October 7, 2018 19:00
parsing IPD data and formatting it, continued

Description of Workflow

Step 3: Create a fasta file of exons that extends the window for mapping reads N base pairs in both directions, where N == the number of base pairs the for the sequencing length. For Illumina, this is usually 75 or 150.

  • Required parameters:
    • ntype -> the type of input, possible options are:
      • rna -> indicates that the input sequenced read data is from rna/cDNA (mutually exclusive with dna)
      • dna -> indicates that the input sequenced read data is from dna (mutually exclusive with rna, do not enter dna for cDNA data)
    • filteredfile -> the file containing the input sequenced reads that will be used. Must be in MHC.dat format
  • Other parameters:
  • flength -> the length of padding for the reads, the default is 75
@disulfidebond
disulfidebond / parse_mhc_workflow_pt2.md
Last active September 2, 2018 20:45
parsing IPD data and formatting it, continued

Description of Workflow

Step 2: Use python file to parse the filtered output from part 1 (most likely the file named 'parsed_mhc_output.txt'). The python script uses argparse(), so it can be called from the commandline with one of the following options, but note that output is to STDOUT, so it will need to be redirected to a file.

  • exonList -> a text file with a comma separated list of exons

  • fastaExonList -> a fasta formatted list of exons

  • mergedFastaList -> a fasta formatted list of cDNA sequences

              #!/usr/bin/python3
              import argparse
    

import time

@disulfidebond
disulfidebond / parse_mhc_workflow_pt1.md
Last active September 2, 2018 20:43
parsing IPD data and formatting it

Description of Workflow

Step 1. download MHC dataset from IPD. It will have the file extension ".dat", however it can be viewed/edited as a text file. Note that it is very large, so opening it in Atom, BBEdit, or similar text editors/IDE is strongly discouraged.

A preview of this dataset is available here:

                login$ head -n 100 MHC_dat.txt 
                ID   NHP00001
                XX   

DT 15/07/2008 (Release)

@disulfidebond
disulfidebond / software_carpentry_2018_etherpad.txt
Created August 31, 2018 02:59
Etherpad from Software Carpentry 2018 Workshop
†Welcome to Software Carpentry Etherpad!
This pad is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents.
Use of this service is restricted to members of the Software Carpentry and Data Carpentry community; this is not for general purpose use (for that, try etherpad.wikimedia.org).
Users are expected to follow our code of conduct: https://docs.carpentries.org/topic_folders/policies/code-of-conduct.html
All content is publicly available under the Creative Commons Attribution License: https://creativecommons.org/licenses/by/4.0/
@disulfidebond
disulfidebond / labkey_setup_ubuntu.sh
Last active August 31, 2018 02:57
Script that automates labkey setup
#!/bin/sh
echo 'WARNING!! THIS SETUP IS NOT INTENDED'
echo 'FOR A PRODUCTION ENVIRONMENT IN ANY CAPACITY!!!'
sleep 3
STARTDIR=$(PWD)
mkdir installspacepg
cd ./installspacepg
@disulfidebond
disulfidebond / bash_profile_example
Created August 30, 2018 23:08
bash profile with comments
# standard bash profile
# segments borrowed from stephnell on Github
# PATH
# You need to have this line of code. It sets up your Bash $PATH, which is the file that directs Bash how to run programs
# the syntax is:
# export -> this tells Bash to set up PATH with the following values:
# PATH= -> this tells Bash to assign whatever your type next to the PATH variable
# $PATH: -> this is *very* important--it tells Bash not to throw away what was in your PATH already,
# # but to append to it instead. If you leave this out, your Bash shell may not work!