Skip to content

Instantly share code, notes, and snippets.

View danmaas's full-sized avatar

Dan Maas danmaas

View GitHub Profile
@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 / 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 / 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 / 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