This gist is updated daily via cron job and lists stats for npm packages:
- Top 1,000 most depended-upon packages
- Top 1,000 packages with largest number of dependencies
- Top 1,000 packages with highest PageRank score
| #!/bin/bash | |
| # Size at the end is * 2048 where 2048 = 1 MB, so 1572864 = 768 MB | |
| #DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://1572864` | |
| DISK=`/usr/bin/hdiutil attach -nobrowse -nomount ram://2097152` | |
| /usr/sbin/diskutil erasevolume HFS+ "RamDiskCache" $DISK | |
| CACHEDIR="/Volumes/RamDiskCache/$USER" |
| class AllowFieldLimitingMixin(object): | |
| """ | |
| A mixin for a generic APIView that will allow the serialized fields to be | |
| limited to a set of comma-separated values, specified via the `fields` | |
| query parameter. This will only apply to GET requests. | |
| """ | |
| _serializer_class_for_fields = {} | |
| def get_serializer_class_for_fields(self, serializer_class, fields): | |
| fields = fields.strip().split(',') |
| from sklearn.metrics import confusion_matrix | |
| def print_cm(cm, labels, hide_zeroes=False, hide_diagonal=False, hide_threshold=None): | |
| """pretty print for confusion matrixes""" | |
| columnwidth = max([len(x) for x in labels]+[5]) # 5 is value length | |
| empty_cell = " " * columnwidth | |
| # Print header | |
| print " " + empty_cell, | |
| for label in labels: | |
| print "%{0}s".format(columnwidth) % label, |
FWIW: I (@rondy) am not the creator of the content shared here, which is an excerpt from Edmond Lau's book. I simply copied and pasted it from another location and saved it as a personal note, before it gained popularity on news.ycombinator.com. Unfortunately, I cannot recall the exact origin of the original source, nor was I able to find the author's name, so I am can't provide the appropriate credits.
jq will sort (-S) the whole file (.) and compare STDOUT (<()) with diff
diff <(jq -S . A.json) <(jq -S . B.json)
| /* | |
| * Encryption for the added user accounts and passwords | |
| * | |
| * Reference: | |
| * https://stackoverflow.com/a/5093422 | |
| * */ | |
| require('dotenv').config() | |
| const CRYPTO = require('crypto') | |
| const Encryption = require('./Encryption') |