Skip to content

Instantly share code, notes, and snippets.

@viktorkelemen
viktorkelemen / gist:9232645
Last active August 29, 2015 13:56
Show the number of lines added and removed by an author
git log --author="YOUR_NAME" --pretty=tformat: --numstat \
| gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }' -
@viktorkelemen
viktorkelemen / gist:9862779
Last active August 29, 2015 13:57
Extracting white noise statistics in GPS coordinate time series
First a GPS time series is decomposed into sub-time series using the EMD. Then the Hurst parameter is estimated for each sub-time series. Finally the sub-time series with H ≤ 0.5 are selected to extract the statistics of the white noise.
1. EMD (Empirical Mode Decomposition)
http://www.slideshare.net/EMYJANE/empirical-mode-decomposition
http://www.slideshare.net/puneet4gupta/hilbert-huang-transformhht
https://github.com/jaidevd/pyhht/blob/master/EMD.py
The EMD method consists of decomposing a time series, x(t), into sub-series, also called Intrinsic Mode Function (IMF). The decomposition of x(t) is done via the study of consecutive local extrema (i.e. two minima in the time interval [t1, t2]).
Each IMF is the result of applying a different band-pass filter with certain cutoff frequencies.
@viktorkelemen
viktorkelemen / 0_reuse_code.js
Created April 16, 2014 16:19
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@viktorkelemen
viktorkelemen / gist:2e7d6f6cf95bb2b3b117
Last active August 29, 2015 14:00
Open an Explorer Window from the CMD on Win7
explorer .
start .
explorer c:\some\folder\path
start %systemroot%
@viktorkelemen
viktorkelemen / gist:7155e0c02f090f16b4e4
Created April 30, 2014 13:45
An URL shortener algorithm
var codeset = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
var base = codeset.length;
function encode(n) {
var converted = "";
while (n > 0) {
converted = converted + codeset[n%base];
n = Math.floor(n/base);
@viktorkelemen
viktorkelemen / gist:7a887d3b076c00fa0652
Created January 5, 2015 12:27
Get used selectors from inline stylesheets
function getUsedSelectors() {
var allRules = [];
_.each(document.styleSheets, function (sheet) {
var rules;
if (sheet.rules) {
rules = _.map(sheet.rules, function (rule) {
return rule.selectorText;
});
@viktorkelemen
viktorkelemen / gist:1470513
Created December 13, 2011 04:04
Replace line break with comma
# Inline
echo 'id1\nid2\nid3' | tr -s '\n\r' ','
# From file
cat ids_width_linebreaks.txt | tr -s '\n\r' ','
# From/to a file
tr -s '\n\r' ',' < ids_with_linebreaks.txt > ids_with_commas.txt
@viktorkelemen
viktorkelemen / gist:1492280
Created December 18, 2011 03:35
Loading CDN hosted jQuery with local fallback
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.6.2.min.js"><\/script>')</script>
@viktorkelemen
viktorkelemen / gist:1509501
Created December 22, 2011 08:26
Load an agent on OSX
launchctl load -w ~/Library/LaunchAgents/[FILE].plist
@viktorkelemen
viktorkelemen / gist:1513563
Created December 23, 2011 08:17
Bash script can tell its location
dir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"