Skip to content

Instantly share code, notes, and snippets.

Rsync Tips & Tricks

  • rsync -auzPhv --delete --exclude-from=rsync_exclude.txt SOURCE/ DEST/ -n
    • -a -> --archive; recursively sync, preserving symbolic links and all file metadata
    • -u -> --update; skip files that are newer on the receiver; sometimes this is inaccurate (due to Git, I think...)
    • -z -> --compress; compression
    • -P -> --progress + --partial; show progress bar and resume interupted transfers
    • -h -> --human-readable; human-readable format
    • -v -> --verbose; verbose output
  • -n -> --dry-run; dry run; use this to test, and then remove to actually execute the sync
@liuyuuan
liuyuuan / rank_metrics.py
Created May 12, 2018 07:02 — forked from bwhite/rank_metrics.py
Ranking Metrics
"""Information Retrieval metrics
Useful Resources:
http://www.cs.utexas.edu/~mooney/ir-course/slides/Evaluation.ppt
http://www.nii.ac.jp/TechReports/05-014E.pdf
http://www.stanford.edu/class/cs276/handouts/EvaluationNew-handout-6-per.pdf
http://hal.archives-ouvertes.fr/docs/00/72/67/60/PDF/07-busa-fekete.pdf
Learning to Rank for Information Retrieval (Tie-Yan Liu)
"""
import numpy as np
@liuyuuan
liuyuuan / number_id.cpp
Created March 21, 2016 15:53
A piece of code to discrete a number to id, according to the specified cut points.
#
# -*- coding:utf-8 -*-
'''
Generating matrix of random numbers.
'''
import sys
import random
import numpy
class randMat(object):
import sys
class Sequence(object):
def __init__(self,seq=None):
self._seq_matrix = list()
if seq is not None:
self._seq_matrix=list()
self._seq_matrix.append(list(seq))
def add_seq(self, seq):
if self._seq_matrix is None:
self._seq_matrix = list()
" Sample .vimrc file by Martin Brochhaus
" Presented at PyCon APAC 2012
" ============================================
" Note to myself:
" DO NOT USE <C-z> FOR SAVING WHEN PRESENTING!
" ============================================
import sys
def count(recs, delimiters):
recs.sort()
delimiters.sort()
c = 0
result = []
for i in recs:
if len(delimiters):
if i <= delimiters[0]:
import sys
def count(recs, delimiters):
recs.sort()
delimiters.sort()
c = 0
result = []
for i in recs:
if len(delimiters):
if i <= delimiters[0]: