Skip to content

Instantly share code, notes, and snippets.

View rivy's full-sized avatar
🏠
Working from home

Roy Ivy III rivy

🏠
Working from home
View GitHub Profile
@rivy
rivy / semverCompare.js
Created August 3, 2022 02:58 — forked from iwill/semverCompare.js
JavaScript - Comparison of Semantic Versioning
/**
* Semantic Versioning Comparing
* #see https://semver.org/
* #see https://stackoverflow.com/a/65687141/456536
* #see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator#options
*/
function semverCompare(a, b) {
if (a.startsWith(b + "-")) return -1
if (b.startsWith(a + "-")) return 1
return a.localeCompare(b, undefined, { numeric: true, sensitivity: "case", caseFirst: "upper" })
@rivy
rivy / node-0mq-ctrl-c.js
Created June 25, 2022 19:25 — forked from terrancesnyder/node-0mq-ctrl-c.js
Handling Ctrl-C cleanly in Node.js
// Show how to handle Ctrl+C in Node.js
var zmq = require('zmq')
, socket = zmq.createSocket('rep');
socket.on('message', function(buf) {
// echo request back
socket.send(buf);
});
@rivy
rivy / ExportKindle.js
Last active March 10, 2022 22:28 — forked from usayamadx/ExportKindle.js
Amazon Kindle Export
// ref: <https://stackoverflow.com/questions/7191429/get-kindle-library-book-list>
// ref: <https://gist.github.com/jkubecki/d61d3e953ed5c8379075b5ddd8a95f22>
// spell-checker:ignore () booklist
// from <https://gist.github.com/rivy/54d86297cc65bd21a25476d4d2da7d31>
// ToDO: [2022-03-10; rivy] change to use `fetch()` and `async/await`
// ... available since early 2017 ... <https://caniuse.com/?search=fetch> , <https://caniuse.com/async-functions>
// 1 - login to "https://read.amazon.com"
// 2 - use "F12" to open developer window with "Console"
@rivy
rivy / git-cache-meta.sh
Created February 7, 2021 20:50 — forked from andris9/git-cache-meta.sh
git-cache-meta
#!/bin/sh -e
#git-cache-meta -- simple file meta data caching and applying.
#Simpler than etckeeper, metastore, setgitperms, etc.
#from http://www.kerneltrap.org/mailarchive/git/2009/1/9/4654694
#modified by n1k
# - save all files metadata not only from other users
# - save numeric uid and gid
# 2012-03-05 - added filetime, andris9
@rivy
rivy / README.md
Created April 3, 2020 17:54 — forked from wrobstory/README.md
Folium Employed Choropleth

A Leaflet.js map created with Folium and the default D3 threshold scale, with data bound between the Pandas DataFrame and the TopoJSON. See the Gist for the python code to generate the dataframe. The map was generated with the following Python code:

map_1 = folium.Map(location=[48, -102], zoom_start=3)
map_1.geo_json(geo_path=county_geo, data_out='data1.json', data=df,
               columns=['GEO_ID', 'Employed_2011'],
               key_on='feature.id',
               fill_color='YlOrRd', fill_opacity=0.7, line_opacity=0.3,
               topojson='objects.us_counties_20m')
map_1.create_map(path='map_1.html')
/* Lorem Ipsum Generator
* (CC-BY) Fredrik Bridell <[email protected]> 2009
* Version 0.21 - multilingual
* Released under a Creative Commons Attribution License
*
* You are welcome to use, share, modify, print, frame, or do whatever you like with this
* software, including commercial use. My only request is that you tell the world where you found it.
*
* One way is to include the phrase:
* "Using the The Lorem Ipsum Generator by Fredrik Bridell (http://bridell.com/loremipsum/)"
@rivy
rivy / README.md
Created July 6, 2019 20:29 — forked from cerebrate/README.md
Recompile your WSL2 kernel - support for snaps, apparmor, lxc, etc.

Recompile your WSL2 kernel - support for snaps, apparmor, lxc, etc.

Yes, I've done this, and yes, it works. It is, however, entirely unsupported and assembled through reasonable guesswork, so if you try this and it explodes your computer, brain, career, relationships, or anything else, you agree that you take sole responsibility for doing it, that I never claimed it was a good idea, and that you didn't get these instructions from me .

Also note: I have done this with Debian Stretch. While one kernel ought to fit all, some of the packages you need to build it may be different. Adapting to other distros is up to you.

Step One: Install the stuff you need to build the kernel

@rivy
rivy / .eslintrc.js
Created July 6, 2019 18:31 — forked from nkbt/.eslintrc.js
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@rivy
rivy / esm_in_node_proposal.md
Created June 27, 2019 14:59 — forked from ceejbot/esm_in_node_proposal.md
npm's proposal for supporting ES modules in node

ESM modules in node: npm edition

The proposal you’re about to read is not just a proposal. We have a working implementation of almost everything we discussed here. We encourage you to checkout and build our branch: our fork, with the relevant branch selected. Building and using the implementation will give you a better understanding of what using it as a developer is like.

Our implementation ended up differing from the proposal on some minor points. As our last action item before making a PR, we’re writing documentation on what we did. While I loathe pointing to tests in lieu of documentation, they will be helpful until we complete writing docs: the unit tests.

This repo also contains a bundled version of npm that has a new command, asset. You can read the documentation for and goals of that comma

#!/usr/bin/env perl
# Copyright 2015 by David Golden
# Licensed under CC0 https://creativecommons.org/publicdomain/zero/1.0/
# Updated 2016-03-01:
# - more variation in organzations selected; you will want to customize this yourself
# - splits out wishlists differently/correctly
# - reports only PRs unless --all is specified
use v5.10;
use strict;
use warnings;