Skip to content

Instantly share code, notes, and snippets.

@popucui
Last active September 30, 2018 04:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save popucui/6f3295d5f854f8b8b54eb8d822f54015 to your computer and use it in GitHub Desktop.
Save popucui/6f3295d5f854f8b8b54eb8d822f54015 to your computer and use it in GitHub Desktop.
# print 2 line into one
awk 'NR%2{printf "%s ",$0;next;}1' yourFile
# copy files using rsync
rsync -avz -h --progress --files-from=./fastq_list user@host:/ .
# change password from script
# this is used not often, yet can be very useful when you need to change passwd from VPS provider's dasgboard
`echo "newpasswd" | passwd root --stdin`
# transform head line to a vector
head -1 /path/to/file_with_multiple_columns.tsv | awk 'ORS=", " { for(i=1; i<=NF; i++) {print "\""$i"\""} }'
# add space for string as "2/13", for MS Excel will automatically recognize "2/13" as date format "Feb. 13th"
sed -i -re 's#([[:digit:]]+/[[:digit:]]+)# \1#' variant_summary/vm_gt002.xls
# map Ensembl transcript ID to Refseq ID
mysql -u anonymous -h ensembldb.ensembl.org homo_sapiens_core_75_37 -B -e
"SELECT transcript.stable_id, xref.display_label FROM transcript, object_xref, xref,external_db
WHERE transcript.transcript_id = object_xref.ensembl_id AND object_xref.ensembl_object_type = 'Transcript'
AND object_xref.xref_id = xref.xref_id AND xref.external_db_id = external_db.external_db_id
AND external_db.db_name = 'RefSeq_mRNA';" > ensemble_refseq.txt
# match single quote in sed
sed -i 's#5'\''URS#5_URS#' downloads/variant_summary.txt
# To escape single quote or double quote in PHP when talking to MySQL, check http://php.net/mysqli_real_escape_string
$city = "'s Hertogenbosch";
$city = mysqli_real_escape_string($link, $city);
@popucui
Copy link
Author

popucui commented Sep 30, 2018

# check my IP address
curl https://api.myip.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment