Well it works.
You have to remove the size of the input (peak is shifted). I got the answer of 469 for the offset.
I computed the cross correlation,
then find the maximum
then compute the distance between this point and the size of the data
which results in the offset.
In your case, I would run the computation on the second half of the data to calculate the offset (when the shapes and amplitudes of the two signals are similar), and then use this result to offset the whole array.