Skip to content

Instantly share code, notes, and snippets.

@victorlin
victorlin / hpc_github.md
Created December 18, 2016 18:46
Using GitHub with HPC
  1. Set your name and email (make sure the email is tied to your GitHub account).

    git config --global user.name <YOUR_NAME>

    git config --global user.email <YOUR_EMAIL>

  • To check global variables, use git config -l
  1. Adding your HPC user SSH key to the ssh-agent
@victorlin
victorlin / djay.py
Created December 23, 2016 20:42
merge iTunes playlist export and djay key/bpm data
"""
Script to crete TSV file containing title/artist/__/BPM/key info
playlist_export_file
iTunes export of playlist (CSV)
auto_fpath
filepath of binary plist file generated by djay.app
"""
import csv
@victorlin
victorlin / README.md
Last active February 21, 2017 19:12
batch run bedtools bam2bed on accepted_hits.bam in subdirectories

bam2bed_all.sh

find

  • man find
  • This command is used to search for files and/or subdirectories in a directory.
  • In this script, find is used to search for immediate subdirectories matching the regular expression R*.dm6. The output of find is a list of each match. These subdirectories are passed through a pipe into a push/pop loop.

pushd and popd

@victorlin
victorlin / get_eel3701c_exams.sh
Last active August 22, 2018 17:26
download all EEL3701C past exams
years='[07-16]'
curl http://www.add.ece.ufl.edu/3701/exams/ex1_sol_s${years}.pdf -o 'ex1_sol_s#1.pdf'
curl http://www.add.ece.ufl.edu/3701/exams/ex2_sol_s${years}.pdf -o 'ex2_sol_s#1.pdf'
curl http://www.add.ece.ufl.edu/3701/exams/fq_no_sol_s${years}.pdf -o 'fq_no_sol_s#1.pdf'
@victorlin
victorlin / fb_video_tracker.py
Created August 22, 2018 17:25
tracking stats of a re-uploaded video
import urllib
import datetime
import time
import string
url = "https://www.facebook.com/theKLIQUE/videos/1079723095393383/"
def printStuff():
fileObj = urllib.urlopen(url)
@victorlin
victorlin / batch-cr2-jpg-downsize-readme.md
Last active September 7, 2018 15:49
Script to convert and downsize RAW photos to small JPG files for fast Google Drive upload

Overview

Script to convert and downsize RAW images. Good for web uploading.

  1. Convert all .CR2 files (RAW) to jpg
  2. Downsize image dimensions by 25%
  3. Move to new directory jpg

Quickstart

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

A manual approach to git rebase that puts current branch commits over new commits in other branch.

git branch -m feature-branch tmp
git checkout dev
git checkout -b feature-branch
git cherry-pick <earliest-sha1>^...<latest-sha1>

git branch -D tmp
{
"properties": {
"sra": "ERR2756788",
"genome": "cov3ma",
"date": "200607-01:47"
},
"families": [
{
"family": "AMR",
"score": "100",
@victorlin
victorlin / create_dated_folders.sh
Last active October 19, 2022 23:35
shell scripts to organize and modify scanned images from Epson FastFoto FF-680W
for f in *.jpg; do
date="${f:0:10}"
if ! [ -d "${date}" ]; then
echo "creating folder ${date}"
mkdir "${date}"
fi
echo "moving ${f}"
mv ${f} ${date}
done