Skip to content

Instantly share code, notes, and snippets.

View rclark's full-sized avatar

Ryan Clark rclark

View GitHub Profile
@rclark
rclark / _readme.md
Last active April 4, 2023 19:05
Pre-commit hook for Golang formatting and linting

Pre-commit git hook to require Golang formatting and linting

  1. Add this file in a local repo at .githooks/pre-commit.
  2. git config core.hooksPath .githooks sets up the hook
@rclark
rclark / readme.md
Last active October 1, 2024 18:52
satisfactory dedicated server on aws

Satisfactory dedicated server on AWS ECS

A CloudFormation stack that you can run in your AWS account to host up a dedicated Satisfactory server.

Thanks to https://github.com/wolveix/satisfactory-server for the Docker image!

Runs on AWS ECS

The dedicated server application runs on ECS Fargate, so you get a more-or-less "serverless" setup. It uses Fargate Spot, which allows you to get the cheapest possible setup, though AWS may choose to stop and restart your server. FWIW I've never actually observed that happening.

      |                                           |                                       |                                                     |                                                         |
      |                                           |                                       |                                                     |                                                         |
      |--------- really no time at all -----------|------------ 7 to 14 days -------------|-------------- really no time at all ----------------|----------------- shouldn't be too long -----------------|
      |                                           |                                       |                                                     |                                                         |
      |                                           |                                       |                                                     |                                                         |

You're going to start up a Linux EC2, set up its firewall rules, and connect to it.

  • If you're not doing production work always try and use the sandbox account, so log into sandbox account.

  • The first thing you need is an AMI, which is like a snapshot that is the starting point for your machine. Go to https://cloud-images.ubuntu.com/locator/ec2/ to find ubuntu AMIs. These are like from-scratch instances that are kept up-to-date with security patches. If you search for 14.04 that'll be the latest stable ubuntu release, then you're looking for one that's in the right region (generally that's us-east-1), the right architecture (usually amd64) and the right instance type (usually that's instance-store). Copy the

  • Clicking on one of the ami-12345 links will pop you over to the AWS EC2 console and start you down the road of creating the instance.

  • First you'll have to choose an instance type. You'll want the smallest (i.e. cheapest) one th

Import times with osm2pgsql

I imported tucson.osm.pbf, a 3.4MB OSM extract.

Where is PostgreSQL Machine Specs Import time
Local 4 CPU, 16GB RAM Macbook Pro 18 seconds
Local i2.4xlarge EC2 76 seconds
Remote m1.medium EC2 > db.m1.large 500GB : 2000 IOPS 112 seconds
Remote i2.4xlarge EC2 > db.m2.4xlarge 1000GB : 10000 IOPS 82 seconds
@rclark
rclark / min-ckan.json
Created November 21, 2013 00:27
Bare-minimum CKAN Package
{
"license_title": "License Not Specified",
"maintainer": "",
"relationships_as_object": [],
"private": false,
"maintainer_email": "",
"revision_timestamp": "2013-11-21T00:22:03.676324",
"id": "f1a90774-c8d0-4c73-947b-63803c2d7525",
"metadata_created": "2013-11-21T00:21:38.099774",
"owner_org": null,
@rclark
rclark / map.js
Created October 29, 2013 22:46
little code review
function onEachFeature(feature, layer) {
/* From the perspective of reading this function, it would be easier if you think about it in a linear fashion
What does this function do?
1) get a single feature
2) parse some specific properties out of the feature
3) use those properties to generate a string of HTML
4) build a popup from that HTML
Right now its a little hard to read because you're jumping around between those steps a bit
*/
@rclark
rclark / color-map.csv
Created October 25, 2013 18:46
Grand Canyon Units
unit colors
Cba #ffebeb,#99b380
Cm #ebebcc,#ffccde
Ct #ffb3cc,#ccde66
Dtb #664dff
H20 #ebffff
IPMs #99ebde
Jc #ccffde
Je #cccc00
Jk #99de99
WeeSofty:tm2 r$ npm install mapnik
npm WARN package.json dirty@0.9.7 No repository field.
npm WARN package.json tilejson@0.3.4 'repositories' (plural) Not supported.
npm WARN package.json Please pick one as the 'repository' field
npm http GET https://registry.npmjs.org/mapnik
npm http 304 https://registry.npmjs.org/mapnik
npm http GET https://registry.npmjs.org/mapnik-vector-tile
npm http 304 https://registry.npmjs.org/mapnik-vector-tile
> mapnik-vector-tile@0.3.2 install /Users/r/gh/mapbox/tm2/node_modules/mapnik/node_modules/mapnik-vector-tile
@rclark
rclark / index.html
Last active December 25, 2015 21:49
Streaming EQ data
<!doctype html>
<html>
<head>
<title>Streaming GeoJSON</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.css" />
<!--[if lte IE 8]>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.ie.css" />
<![endif]-->
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<style type="text/css">html, body, #map { height: 100%; width: 100%; margin: 0px; }</style>