Hacker Newsnew | past | comments | ask | show | jobs | submit | hellabites's commentslogin

Just because I like GNU parallel:

    parallel -kj1 'f="{}"; [[ -f "${f/data/A}" ]] || echo $f' ::: *_data.csv


This is better relative to the `sed` solution as it handles the `0000` case well.


I didn't realize Zsh (and Bash) was capable of removing zero padding in that way.

Everybody has there own style, but I would prefer to print the missing file pattern and avoid loops.

If you have GNU parallel installed (works in bash)

     parallel -kj1 '! [[ -f "{}" ]] && echo {} || :' ::: $(jot -w %04d_A.csv - 1 501)
or if preferred

     parallel -kj1 '! [[ -f "{}" ]] && echo {} || :' ::: {0001..0500}_A.csv


> I didn't realize Zsh (and Bash) was capable of removing zero padding in that way.

Well, it's for transforming an integer in a different bases like octal, binary until base 24 (or more don't recall), but it can be abused to strip padding zeroes from variables. Using printf should probably be cleaner but usually I only recall the the C syntax...

I think I have parallel installed but I tend to use xargs out of habit, mostly because I was forced to use xargs in locked out production systems.

If the number of files wouldn't be so big, I'd simply expand them on ls and capture stderr:

    ls {0001..0500}_A.csv 1> /dev/null
It's a little nosier with the error messages but it's fast. With 500 files I'm sure I'll exhaust the shell parse(?) buffer:

    (ls {0001..0500}_A.csv 2>&1 1> /dev/null) | awk -F\' '{print $2}'
and too much complications to suppress stdout and pipe only stderr. ^__^;


Just for fun some bash:

    for k in $(seq -f %04.f 1 501); do 
        f="${k}_A.csv"
        ! [[ -f "$f" ]] && echo $f || :
    done
or more succinctly,

    for k in {0001..0501}_A.csv; do
        ! [[ -f "$f" ]] && echo $f || :
    done
and if you have GNU parallel installed:

    parallel -kj1 '! [[ -f "{}" ]] && echo {} || :' ::: {0001..0501}_A.csv


My cat perpetually wants to go outside.


Gold had intrinsic value before electronics, but for basically the same reason: it's immutable.

The bitcoin blockchain is also immutable.


Github flavored markdown does do tables (in a manner that's almost equivalent to org): https://github.com/adam-p/markdown-here/wiki/Markdown-Cheats...


in a manner that's almost equivalent to org

Not really, in org-mode, you can compute columns using expressions (like in a spreadsheet) [1]. Moreover, you can feed a table to an (executable) source code block and/or you can store the output of a source code block to a table.

Just to give an example why this could be useful: suppose that you have a code snippet that produces some statistics. You can execute this snippet directly in the org-mode document and have the result in an org table. Then, you could execute another code snippet (e.g. using R) that uses the table as the input and produces a graph that is embedded inline in your org document. In GUI Emacs, you can even preview the resulting graph.

My primary criticism is that the value of org-mode documents decreases enormously outside Emacs.

[1] http://orgmode.org/worg/org-tutorials/org-spreadsheet-intro....


I still use emacs in '-nw' mode because, I don't know, I'm old, but re: your criticism, skewer-mode[1] is available. Presuming your output is targeting some form of HTML, this enables you to retain the ability to at least present your information locally (on your own file system), to colleagues (authenticate via your existing SSO or whatever), or even to a public site (via a simple git-push to via a standard httpd on a container). I'm sure there are other modes out there, (hell, you could write something from scratch in a few minutes with inotify to cater to all your specific needs). I'd say it'd be more accurate to qualify your statement as such: "the value of org-mode documents decreases as a platform to manipulate (but not distribute) your data outside of emacs"[2].

[1] https://github.com/skeeto/skewer-mode [2] And even then, modern cell phones have quad-core 1ghz ARMs on them. I was using org-mode with a P3 600, I'm sure modern phones + a Bluetooth keyboard would be sufficient to run emacs, or at least SSH + emacsclient.


I'd say it'd be more accurate to qualify your statement as such: "the value of org-mode documents decreases as a platform to manipulate (but not distribute) your data outside of emacs"[2].

Definitely, that's what I meant. I share org stuff with ox-html or ox-latex. But colleagues cannot really use my org documents unless they are on Emacs.


To your [2] - you can run it, but legibility is kind of a problem. Also, the next Bluetooth keyboard I find that supports remapping Caps Lock to Control will be the first.


How ugly it is, sigh.


This can be rather difficult for general data where an explicit equation isn't obvious (even though it'll work quite often as pointed out by johncolanduoni below).

[I think it's neat that] for sufficiently smooth and periodic data, a Fourier transform will do exactly this (decompose a function into its even and odd parts)!


I'm confused. If you have a table of data where one of the columns varies from -A to A, what is the difficulty in calculating the odd and even parts by just adding (resp. subtracting) the values at x and -x and dividing by two? Even if you don't have a precisely symmetric span of x values you can use simple interpolation as long as your data points are reasonably dense.

Fourier analysis seems to be overkill in this case, unless I'm missing something.


Your algorithm had a bit of a typo--you want to subtract (resp. add) to calculate the odd and even parts of a function.

If you don't have a nearly symmetric span of x values, you may need to do extrapolation to obtain one, which may be difficult.

I brought up Fourier analysis not as a means to replace the decomposition described in the blog, but to connect it. I think it's neat that Fourier transformations can be viewed as a parity decomposition.


if your data are over [a,b], where a < 0 and b > 0, you can do the decomposition mentioned in the article over [-c,c], where c = min(|a|,|b|), so you don't need to extrapolate.


Two fluids with a density difference and a velocity gradient usually have a common force acting upon them, e.g. gravity, which enforces so-said interface. Perturbations to the average interface are restored via this force, and these perturbations are called gravity waves.

KH Instabilities give rise to gravity waves.


Name seems fine to me.

From the first paragraph of the wiki-page:

In fluid dynamics, gravity waves are waves generated in a fluid medium or at the interface between two media when the force of gravity or buoyancy tries to restore equilibrium. An example of such an interface is that between the atmosphere and the ocean, which gives rise to wind waves.


but the same waves could be reproduced without gravity in an appropriate accelerating frame (e.g. in a rotating body at a Lagrange point) so gravity isn't _essential_, whereas it is for gravitational waves


Gravity is the result of an appropriately accelerating frame (i.e. the curvature of spacetime).


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: