Skip to content

Instantly share code, notes, and snippets.

View coopernurse's full-sized avatar

James Cooper coopernurse

View GitHub Profile
@coopernurse
coopernurse / account.go
Created February 22, 2023 20:04
sorting embedded struct via generics
package model
type Account struct {
Entity
Username string `json:"username" dynamodbav:"username"`
Name string `json:"name,omitempty" dynamodbav:"name"`
Broker string `json:"broker,omitempty" dynamodbav:"broker"`
AuthKey string `json:"authkey,omitempty" dynamodbav:"authkey"`
BrokerAccountID string `json:"brokeraccountid,omitempty" dynamodbav:"brokeraccountid"`
LastSyncMillis int64 `json:"lastsync,omitempty" dynamodbav:"lastsync"`
@coopernurse
coopernurse / main.dart
Last active April 8, 2022 17:57
dart hello world
import 'package:flutter/material.dart';
import 'dart:math';
import 'dart:async';
void main() {
runApp(CalendarApp());
}
class CalendarApp extends StatelessWidget {
Widget build(BuildContext context) {
@coopernurse
coopernurse / freelance_producer_coop.md
Last active November 21, 2019 21:45
Software Freelancer Producer Co-Op

Motivation

  • Freelancers (be they contractors or consultants) live and die by lead generation
  • Most lead generation is word of mouth (trust based)
  • Good clients are hard to find
  • Bias towards avoiding downtime (gotta pay that mortgage)

This leads to the following:

  • Over time, freelancers will sign long term retainers with their best clients.
#
# Maelstrom project file for bookstack
# https://maelstromapp.com/
# https://www.bookstackapp.com/
#
# Dependencies: mysql or mariadb, docker, maelstrom
#
---
name: bookstack
components:
@coopernurse
coopernurse / abstract.md
Created July 28, 2018 18:19
SeaGL 2018 Proposal

Title

Robust image resizing

Abstract

If your application handles images you've probably written something to crop and resize them. It's simple enough to execute ImageMagick with the appropriate flags, but is that sufficient?

In this talk we will:

@coopernurse
coopernurse / ReproDiskConsistency.java
Created September 14, 2017 13:10
ReproDiskConsistency
package com.imprev.util;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3Client;
import com.amazonaws.services.s3.model.ObjectListing;
import com.amazonaws.services.s3.model.S3Object;
import com.amazonaws.services.s3.model.S3ObjectSummary;
import com.imprev.soa.util.*;
import org.apache.log4j.Logger;
@coopernurse
coopernurse / RedisThreadingTest.java
Last active September 11, 2017 20:51
RedisThreadingTest
package com.imprev.util;
import com.imprev.soa.redis.JedisRetry;
import com.imprev.soa.util.Log4JInit;
import com.imprev.soa.util.RandomString;
import com.imprev.soa.util.RedisTTLCache;
import org.junit.Test;
import redis.clients.jedis.JedisPool;
import redis.clients.jedis.JedisPoolConfig;
Send some messages
------------------
james ~/src/imprev/docker/images/ftp-s3-sync $ aws sqs send-message --queue-url $Q_URL --message-body 'message-0'
{
"MD5OfMessageBody": "8ab5fbd7628b8c70d0382fc34fd601af",
"MessageId": "4a8616a8-3b62-42a5-bb2b-6a1f53e715e2"
}
james ~/src/imprev/docker/images/ftp-s3-sync $ aws sqs send-message --queue-url $Q_URL --message-body 'message-1'
import com.fasterxml.jackson.databind.ObjectMapper;
public class MyData {
public static void main(String argv[]) throws Exception {
String json = "{\"name\": \"foo\", \"age\": 30 }";
MyData d = new ObjectMapper().readValue(json, MyData.class);
System.out.println(" json: " + json);
System.out.println("deserialized: " + d);
}
@coopernurse
coopernurse / entity-sync.md
Last active May 18, 2017 22:47
entity sync spec

incremental entity fetch

entity-change-log

Description:

This endpoint returns a paginated list of changes in the system. Calling systems can use this to periodically fetch the list of entities that have been modified over a given time period.