CARVIEW |
Select Language
HTTP/2 200
date: Thu, 31 Jul 2025 11:29:41 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
x-robots-tag: none
etag: W/"04886455784d5eb6bd2dd5b5d95c4c69"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: no-referrer-when-downgrade
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=hhrXfIRqeFZqFWMGATT3lhyjlMejlbtoPrS5uUx0Gamkk2cD4ErRw80OIdC%2FyTWbhhyyWKxVAzqrzMmpne7dL83UwNJYAwhF9G8PnmLG7GJndDTsTWML8ewN%2FYAnSsQifzFXQZ0kIpLVG9nmCrDiCJfYE4M7nNwc9p5ph3N6xjqbLq3Dhy9kmilaQ5sN5cK8BKOiFZ4ppmyHGuI5kKsNiCRkWuBzQgMtC5FKUFhDPRWizY5o1l%2BBENv%2B0Pk4W3I1yx%2FCOFHz%2BTE9rnlejRPekg%3D%3D--L1v%2B02AOZOFlaPlu--5viGqsHVOblB2NiALammvg%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.990727733.1753961381; Path=/; Domain=github.com; Expires=Fri, 31 Jul 2026 11:29:41 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Fri, 31 Jul 2026 11:29:41 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: B6EA:1E01C6:9213BC:AE98C3:688B53A5
Cookbook · raine/ramda-cli Wiki · GitHub
Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 12
Cookbook
Raine Virta edited this page Mar 11, 2017
·
40 revisions
Feel free to contribute to this document with ramda-cli snippets that have helped you.
- Create a markdown formatted table of Ramda's functions
- Merge JSON files into a single object
- Unwrap a list of objects into Line Delimited JSON
- Read filenames from stdin as an object of
{filename: body}
- Inspect MongoDB collection as a table
- Create an
<img>
tag based onidentify
output - Get a table of things occurring per minute
- Playing around with country-data
- View a npm module on GitHub
- Query S3 API and push total object count and size to statsd
Output from ramda-cli can be piped to markdown-cli-table to create a Markdown formatted table.
npm install -g markdown-table-cli
curl -s https://raine.github.io/ramda-json-docs/latest.json | \
R 'project <[ name sig category ]>' \
'map evolve sig: (-> it and "`#it`"), name: -> "[`#it`](https://ramdajs.com/docs/##it)"' \
| md-table
name | sig | category |
---|---|---|
add |
Number -> Number -> Number |
Math |
adjust |
(a -> a) -> Number -> [a] -> [a] |
List |
always |
a -> (* -> a) |
Function |
aperture |
Number -> [a] -> [[a]] |
List |
cat *.json | R --slurp merge-all
cat data.json | R --unslurp --compact identity
find . -name '*.txt' | R -r --slurp 'map -> (it): read-file it' merge-all
mongoexport -d test -c zips --jsonArray -q '{state: "NY"}' --sort '{pop: -1}' |\
R identity -o table | less -F
The result looks something like this:

$ identify test.png
test.png PNG 594x472 594x472+0+0 8-bit sRGB 187KB 0.000u 0:00.009
$ img-tag test.png
<img src="test.png" width="594" height="472">
#!/usr/bin/env bash
identify "$1" | R -Rr \
'match /(^.+?) .+\b(\d+)x(\d+)\b/' \
'tail' \
'zip-obj [\src, \width, \height]' \
'h \img, _' \
'.outer-HTML' \
'replace "<\/img>", ""'
I use this to create img tags for retina images with dimensions of half the
size (for GitHub READMEs). For that you have to add this after the zip-obj
line.
'f=parse-int >> (/ 2); evolve width: f, height: f' \
By using countBy
, we get counts for
elements of a list according to how many match the supplied function.
In this case, we pass a function that parses a time
field and formats it to
%H %M
with strftime
module.
query-es 'url:catpics' | R --import strftime -s -o table -c \
'count-by -> strftime("%R", new Date it.time)'
┌───────┬────┐
│ 11:58 │ 10 │
│ 11:59 │ 26 │
│ 12:00 │ 32 │
│ 12:01 │ 96 │
│ 12:02 │ 80 │
│ 12:03 │ 44 │
│ 12:04 │ 46 │
│ 12:05 │ 66 │
└───────┴────┘
Repository: https://github.com/samayo/country-data
git clone git@github.com:samayo/country-data.git
cat src/country-{population,continent,domain-tld}.json | R --slurp -o table -c \
'unnest' \
'group-by (.country)' \
'map-obj merge-all' \
'values'
┌──────────────────────┬────────────┬───────────────┬─────┐
│ country │ population │ continent │ tld │
├──────────────────────┼────────────┼───────────────┼─────┤
│ Aruba │ 103000 │ North America │ .aw │
│ Afghanistan │ 22720000 │ Asia │ .af │
│ Angola │ 12878000 │ Africa │ .ao │
│ Anguilla │ 8000 │ North America │ .ai │
│ Albania │ 3401200 │ Europe │ .al │
│ Andorra │ 78000 │ Europe │ .ad │
│ Netherlands Antilles │ 217000 │ North America │ .an │
│ United Arab Emirates │ 2441000 │ Asia │ .ae │
│ Argentina │ 37032000 │ South America │ .ar │
│ Armenia │ 3520000 │ Asia │ .am │
└──────────────────────┴────────────┴───────────────┴─────┘
cat src/country-population.json | R --import approximate-number -o table -c \
'sort-by prop \population'
'map evolve population: approximate-number'
'reverse'
┌────────────────────┬────────────┐
│ country │ population │
├────────────────────┼────────────┤
│ China │ 1.3b │
│ India │ 1b │
│ United States │ 278m │
│ Indonesia │ 212m │
│ Brazil │ 170m │
│ Pakistan │ 156m │
│ Russian Federation │ 147m │
│ Bangladesh │ 129m │
│ Japan │ 127m │
│ Nigeria │ 112m │
└────────────────────┴────────────┘
https://twitter.com/rane/status/647391424930050048/
#!/usr/bin/env bash
# First aws command gets the immediate prefixes under photo/, second the sum
# of objects' sizes and count for each prefix.
aws s3api list-objects --bucket my-bucket --prefix photo/ --delimiter '/' |\
R --raw-output '.CommonPrefixes' 'pluck \Prefix' 'map split "/"' 'map nth 1' |\
xargs -P4 -I % aws s3api list-objects --bucket my-bucket --prefix photo/% \
--query '{%: [sum(Contents[].Size), length(Contents[])]}' |\
R --raw-output --slurp \
merge-all to-pairs \
'map -> zip-with ((k,v) -> "#k.#{it.0}:#v|g"), <[ s3_total_size s3_count ]>, it.1' \
flatten \
"map concat '$statsd__prefix.'" |\
xargs -t -n1 ./statsd-client
./statsd-client photos.s3_total_size.BR:125124255|g
./statsd-client photos.s3_count.BR:5124|g
./statsd-client photos.s3_total_size.FI:3017284917|g
./statsd-client photos.s3_count.FI:2451|g
./statsd-client photos.s3_total_size.DE:91873259|g
You can’t perform that action at this time.