Skip to content

Instantly share code, notes, and snippets.

View danmaas's full-sized avatar

Dan Maas danmaas

View GitHub Profile
@danmaas
danmaas / expo-gl+11.0.3.patch
Created January 19, 2022 22:55
expo-gl 11.0.3 patch / concurrency and background rendering
diff --git a/node_modules/expo-gl/ios/EXGL/EXGLContext.mm b/node_modules/expo-gl/ios/EXGL/EXGLContext.mm
index 0a904ab..2bd2fdf 100644
--- a/node_modules/expo-gl/ios/EXGL/EXGLContext.mm
+++ b/node_modules/expo-gl/ios/EXGL/EXGLContext.mm
@@ -18,6 +18,7 @@ @interface EXGLContext ()
@property (nonatomic, strong) dispatch_queue_t glQueue;
@property (nonatomic, weak) EXModuleRegistry *moduleRegistry;
@property (nonatomic, weak) EXGLObjectManager *objectManager;
+@property (atomic) BOOL appIsBackground; // tracks the app's foreground/background state
@danmaas
danmaas / ecs_fargate_warn_on_fail.tf
Created December 23, 2021 15:53
How to send an SNS notification for ECS Fargate container failures
# CloudWatch Event Rule to catch non-normal container exit codes
resource "aws_cloudwatch_event_rule" "fargate_container_error" {
name = "${var.sitename}-fargate-container-error"
description = "Container stopped with a non-zero exit code"
event_pattern = <<PATTERN
{
"source": [
"aws.ecs"
],
"detail-type": [
@danmaas
danmaas / CorePlaneOkHttpClientFactory.java
Last active November 9, 2023 09:55
CorePlane OkHttp DNS IPv4 preference
// Customize OkHttp to add IPv4 DNS preference
import com.facebook.react.modules.network.OkHttpClientProvider;
import com.facebook.react.modules.network.OkHttpClientFactory;
import okhttp3.OkHttpClient;
public class CorePlaneOkHttpClientFactory implements OkHttpClientFactory {
public OkHttpClient createNewNetworkModuleClient() {
return OkHttpClientProvider.createClientBuilder()
.dns(new CorePlaneOkHttpDNSSelector(CorePlaneOkHttpDNSSelector.IPvMode.IPV4_FIRST))
@danmaas
danmaas / flat_to_bin.py
Created July 15, 2021 22:19
StarPro star file generation scripts
#!/usr/bin/python
# Convert flat text file of star data into a packed binary format for StarPro.
#
# Input: one star per line, in the text format
# RA DEC MAG RED GREEN BLUE RANGE
#
# where RA/DEC are in degrees, RED GREEN BLUE are floating-point with the greatest
# of the three normalized to 1.0. RANGE is light-years from sun, or -1 for unknown (infinite) range.
#
@danmaas
danmaas / expo-notifications+0.8.2.patch
Created December 23, 2020 00:01
Expo-notifications hack patch to fix iOS provisional permissions
diff --git a/node_modules/expo-notifications/ios/EXNotifications/Permissions/EXNotificationPermissionsModule.m b/node_modules/expo-notifications/ios/EXNotifications/Permissions/EXNotificationPermissionsModule.m
index 4b5fcb6..af045f3 100644
--- a/node_modules/expo-notifications/ios/EXNotifications/Permissions/EXNotificationPermissionsModule.m
+++ b/node_modules/expo-notifications/ios/EXNotifications/Permissions/EXNotificationPermissionsModule.m
@@ -45,10 +45,15 @@ - (instancetype)init
requester:(UMPromiseResolveBlock)resolve
rejecter:(UMPromiseRejectBlock)reject)
{
+ // DJM - revert part of this commit: https://github.com/expo/expo/commit/4500a7536a9d21ce4b1c895d6a11b960be10a82a
+ // which drops the requestedPermission parameter: https://github.com/expo/expo/issues/11414
@danmaas
danmaas / alb-ingress-iam-policy.json
Last active December 27, 2018 22:46
AWS IAM policy for alb-ingress-controller (see https://github.com/helm/charts/tree/master/incubator/aws-alb-ingress-controller). This grants the necessary permissions to create and manage ALBs for supporting Kubernetes Ingress resources.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": ["acm:DescribeCertificate", "acm:ListCertificates"],
"Resource": "*"
},
{
"Effect": "Allow",
@danmaas
danmaas / leelaz-remote.sh
Last active December 26, 2018 22:05
Leela Zero remote wrapper script
#!/bin/sh
# this is a wrapper script that runs leelaz via SSH on a fast cloud instance
# suitable as a drop-in replacement for the leelaz command used by the Lizzie GUI
# see general instructions at https://docs.google.com/document/d/1P_c-RbeLKjv1umc4rMEgvIVrUUZSeY0WAtYHjaxjD64/edit
# use p3.2xlarge instance, "Deep Learning Base AMI (Ubuntu) Version 14.0+" (ami-012b19f1736b6aae8)
# login:
# - nvidia-smi (verify GPU exists)
@danmaas
danmaas / myapp-deployment.yaml
Created December 11, 2018 07:55
Continuous Deployment to Google Kubernetes Engine with CircleCI (Kubernetes Deployment)
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: staging-app
labels:
app: myapp
spec:
template:
metadata:
labels:
@danmaas
danmaas / circleci-config.yml
Last active February 8, 2019 20:53
Continuous Deployment to Google Kubernetes Engine with CircleCI (config.yaml)
version: 2
jobs:
build_and_test:
# ... insert your test suite here
docker_push:
# Build app container and push it to the GCR registry
# Note: we want to build and push an image with tags based on both
# the Git commit hash AND the branch name. This way, we can refer to
MATTERMOST-WEBAPP NPM DEPENDENCIES:
(first-degree only)
Note: "Missing" means the code is used by mattermost-webapp, but is not mentioned in NOTICE.txt.
- bootstrap-colorpicker: out-of-date copyright info
- bootstrap: removed, but still referenced in NOTICE.txt
- chart.js: out-of-date copyright info
- deep-equal: missing
- exif2css: missing