Skip to content

Instantly share code, notes, and snippets.

View ryparker's full-sized avatar
🍊

Ryan Parker ryparker

🍊
View GitHub Profile
@ryparker
ryparker / README.md
Created December 31, 2022 05:12 — forked from veltman/README.md
Generating an SVG from a set of shapefiles

Generating an SVG from a set of shapefiles

The USGS provides detailed downloads of fire perimeters, with timestamped files that can be used to show the spread of a major fire over time.

Using the 2017 Thomas fire as an example, we'll process this data into a single SVG file with all the different perimeter measurements.

This index page contains links to a series of shapefiles of the fire boundary, each one with a timestamp:

https://rmgsc.cr.usgs.gov/outgoing/GeoMAC/2017_fire_data/California/Thomas/

@ryparker
ryparker / esm-package.md
Created September 9, 2021 15:17 — forked from sindresorhus/esm-package.md
Pure ESM package

Pure ESM package

The package linked to from here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@ryparker
ryparker / purging-old-artifacts-with-github-api.md
Created April 20, 2021 19:43 — forked from lelegard/purging-old-artifacts-with-github-api.md
Purging old artifacts with GitHub Actions API

With GitHub Actions, a workflow can publish artifacts, typically logs or binaries. As of early 2020, the life time of an artifact is hard-coded to 90 days (this may change in the future). After 90 days, an artifact is automatically deleted. But, in the meantime, artifacts for a repository may accumulate and generate mega-bytes or even giga-bytes of data files.

It is unclear if there is a size limit for the total accumulated size of artifacts for a public repository. But GitHub cannot reasonably let multi-giga-bytes of artifacts data accumulate without doing anything. So, if your workflows regularly produce large artifacts (such as "nightly build" procedures for instance), it is wise to cleanup and delete older artifacts without waiting for the 90 days limit.

Using the Web page for the "Actions" of a repository, it is possible to browse old workflow runs and manually delete artifacts. But the procedure is slow and tedious. It is fine to delete one selected artifact. It is not for a regular cleanup. We need

@ryparker
ryparker / Fastlane
Created April 13, 2021 20:36 — forked from jukben/Fastlane
Fastlane – example how to increment versions based on package.json
# ios
match(...)
package = load_json(json_path: "../package.json")
increment_version_number(version_number: package["version"])
increment_build_number(build_number: ENV["CIRCLE_BUILD_NUM"] || 1)
# android
package = load_json(json_path: "../package.json")
@ryparker
ryparker / Fastfile
Last active March 25, 2021 21:28
Fastlane `Bump` lane
desc "Bumps the version and build number on the project"
desc "#### Example:"
desc "```\nfastlane ios bump version:2.0.1 build_number:23\n```"
desc "#### Options"
desc " * **`version`**: The version to set in the Info.plist (`CFBundleShortVersionString`)"
desc " * **`build_number`**: The build number to set in the Info.plist (`CFBundleVersion`)"
desc ""
lane :bump do |options|
# Prompt version number
version = nil
// 1. Any live cell with fewer than two live neighbors dies, as if caused by under-population.
// 2. Any live cell with two or three live neighbors lives on to the next generation.
// 3. Any live cell with more than three live neighbors dies, as if by over-population..
// 4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.
const input = [
[0, 0, 1],
[0, 0, 0],
@ryparker
ryparker / append-char-to-dirs.sh
Created October 14, 2020 20:41
Append char to matching dirs
#!/bin/bash
echo "start"
for fp in `find src/__tests__ -type d`; do
D="$(basename $fp)"
newFp=''
if [[ "${D}" == "GET" ]]; then
newFp="${fp:0:(${#fp}-3)}_${D:(-3)}"
@ryparker
ryparker / LambdaConstants.java
Created July 28, 2020 23:06 — forked from seeebiii/LambdaConstants.java
Available default environment variables in AWS Lambda. Just copy&paste into your Node or Java project.
public class Constants {
/**
* Contains the path to your Lambda function code.
*/
public static final String LAMBDA_TASK_ROOT = System.getenv("LAMBDA_TASK_ROOT");
/**
* The environment variable is set to one of the following options, depending on the runtime of the Lambda function:
* AWS_Lambda_nodejs, AWS_Lambda_nodejs4.3, AWS_Lambda_nodejs6.10