Skip to content

Instantly share code, notes, and snippets.

@donarus
donarus / gist:23f0169a322dd27ead9876ea4269c68e
Created August 19, 2021 14:54 — forked from trongthanh/gist:2779392
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.
ID Date Team Acquired Relinquished Notes season seasonStart seasonEnd diffFromSeasonStart diffFromSeasonEnd diffFromNext
1 2008-10-29 Pacers Mike Dunleavy Jr. placed on IL with sore right knee 2008-09 2008-10-23 2009-04-20 6 173 70
2 2009-01-07 Pacers Mike Dunleavy Jr. activated from IL 2008-09 2008-10-23 2009-04-20 76 103 41
>>>>>>
this is part for which is the condition NBA_IL_days_ver2 satisfied
the season 2008-09 starts on 2008-10-23 and ends on 2009-04-20
the diff between date of event with ID 3 and end of this season is 62, but in the example in the documentation, there is value 57 ... I assume this is issue of provided example data... Please confirm
library(RCurl)
library(XML)
library(plyr)
library(doParallel)
######## SETTINGS BEGIN
defaultUserAgent <- paste0(
"AcademicAgent. Collecting historic performance and biographical data ",
"of individual players for student academic research purposes only, not for ",
"commercial use or sharing. Webpage containing description of academic research ",
http://d.stavrovski.net/blog/post/how-to-install-and-setup-oracle-java-jdk-in-centos-6
# rpm
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.rpm" \
-O jdk-7-linux-x64.rpm
# ubuntu
@donarus
donarus / R_n_max_indexes.R
Created January 6, 2015 12:11
get indexes of N max items in R
library(microbenchmark)
library(testthat)
# PARTIAL SORT
# using sort partial
pasort <- function(data, count) {
partIdxs <- which(data >= -sort(-data, partial=count)[count])
partData <- data[partIdxs]
dataOrder <- order(partData, decreasing = TRUE)
partIdxs[dataOrder][1:count]
@donarus
donarus / SimpleTree.java
Last active December 28, 2015 19:59
Simple reimplementation of CSS3 Tree (by Martin Ivanov) as a component for Tapestry5-jquery framework (standard one is too complex and does not allow using of zones) http://acidmartin.wordpress.com/2011/09/26/css3-treevew-no-javascript/
package cz.donarus.tagr.web.components.bootstrap;
import org.apache.tapestry5.BindingConstants;
import org.apache.tapestry5.ClientElement;
import org.apache.tapestry5.ComponentResources;
import org.apache.tapestry5.Link;
import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.internal.util.CaptureResultCallback;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.json.JSONArray;
@donarus
donarus / switchClass.js
Created June 6, 2013 22:20
Simple jQuery plugin for dynamic changing classes of html elements. The main goal of this simple plugin is to allow changing bootstrap spanX classes dynamically. For example on large display, you want to have two divs with classes 'span3' and 'span9'. On small displays you might want to have class 'span5' for first div and 'span6' for second. Th…
/*
* Author: Tadeas 'donarus' Palusga - www.palusga.cz - tadeas@palusga.cz
* Licence: Do whatever you want and let me know if it helps :)
*/
if (typeof Object.create !== 'function') {
// function Object.create could be undefined in older browsers
Object.create = function (obj) {
function F() {
};