Skip to content

Instantly share code, notes, and snippets.

@jschr
jschr / wifi-connect.js
Last active September 14, 2018 03:54
Kill resin-wifi-connect on failed attempt.
import { spawn } from 'child-process-promise';
import readline from 'readline';
export default function wifiConnect(ssid) {
const promise = spawn('wifi-connect', [`--portal-ssid=${ssid}`]);
const childProcess = promise.childProcess;
readline
.createInterface({
input: childProcess.stderr,
@jschr
jschr / open.sh
Created March 12, 2018 02:41
Open VSCode with proxy server
open /Applications/Visual\ Studio\ Code.app --args \
--proxy-server=localhost:5555 \
--ignore-certificate-errors
@jschr
jschr / keybase.md
Created March 12, 2018 01:40
keybase.md

Keybase proof

I hereby claim:

  • I am jschr on github.
  • I am jschr (https://keybase.io/jschr) on keybase.
  • I have a public key ASCNojj9T9HQj66TpcpiOtX-KzFVfknk25JPASo1q4Ogpgo

To claim this, I am signing this object:

@jschr
jschr / parseYouTubeUrl.js
Last active February 8, 2024 05:57
Parse YouTube URLs
import UrlPattern from 'url-pattern';
import qs from 'query-string';
// Returns YouTube Player API options from a YouTube URL.
// ie. { playlistId }
// { videoId, start, end }
// { query }
export default function parseYouTubeUrl(url) {
const [domain, querystring] = url.split('?');
const options = {};
@jschr
jschr / App.js
Last active September 20, 2017 04:58
state-provider api
import { createStateProvider, createStateSlicer } from 'state-provider'
import ProfileForm from './ProfileForm'
const Provider = createStateProvider('app')
const Slicer = createStateSlicer('app')
async function saveUser(user) {
await api.saveUser(user)
}
@jschr
jschr / mailgun-terraform-output.txt
Created April 13, 2017 01:05
Mailgun terraform output
module.app.mailgun_domain.domain:
receiving_records.# = 2
receiving_records.0.priority = 10
receiving_records.0.record_type = MX
...
sending_records.# = 3
sending_records.0.name = jschr.io
sending_records.0.record_type = TXT
sending_records.0.valid = valid
...
@jschr
jschr / infrastructure.yml
Last active April 13, 2017 00:37
terraform infrastructure
/env-dev # dev environment, also contains terraform state files after deploying
dev.tf # dev environment terraform config
dev.tfvars # dev envrionment variables
/modules
/app # all of the infrastructure is created with a single app module
variables.tf # the app module's input variables
lambda.tf # the lambda function and required polices / permissions
cloudwatch.tf # a cloudwatch event to invoke the lambda function every 15 minutes
s3.tf # the s3 bucket for the static website
cloudfront.tf # the cloudfront distribution
@jschr
jschr / env-structure.yml
Last active April 12, 2017 13:51
terraform env directory structure
/env-dev # our dev environment and where terraform is deployed from
dev.tf # the dev environment terraform config
dev.tfvars # the terraform variables for dev
@jschr
jschr / modules-structure.yml
Created April 12, 2017 05:15
modules structure
/modules
/app #
app.tf #
lambda.tf
s3.tf
cloudwatch.tf
cloudfront.tf
route53.tf
mailgun.tf
@jschr
jschr / variables.tf
Last active April 13, 2017 00:38
terraform app module variables
variable "domain" { }
variable "github_username" { }
variable "mailgun_smtp_password" { }