Skip to content

Instantly share code, notes, and snippets.

@ronny
ronny / apollo-server-integration-cloudflare-workers.ts
Last active November 17, 2022 00:03
Apollo Server v4 integration for Cloudflare Workers
/*
Context:
- https://github.com/apollographql/apollo-server/issues/6034
- https://github.com/apollographql/apollo-server/blob/version-3/packages/apollo-server-cloudflare/src/ApolloServer.ts
- https://github.com/cloudflare/workers-graphql-server/blob/master/src/index.js
This is largely based on the Lambda integration:
https://github.com/apollo-server-integrations/apollo-server-integration-aws-lambda/blob/main/src/index.ts
@ronny
ronny / brew-pin-older-version.md
Created July 3, 2018 04:39
brew pin an older version

This is handy if you have already upgraded and cleaned the older version from the Cellar.

Uninstall the latest version:

brew uninstall kubernetes-cli

Find the git SHA1 for the version that you want, then find the raw link from github, and install from it:

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/d09d97241b17a5e02a25fc51fc56e2a5de74501c/Formula/kubernetes-cli.rb
@ronny
ronny / direct-plex-atv4.md
Last active April 28, 2024 14:02
Direct play Plex videos in TV 4

DirectPlay Plex videos in TV 4

TV 4 and TV 4K

TV 4 supports HEVC natively up to 1080p30 (I think).

TV 4K has a hardware HEVC decoder that can support up to 2160p60.

Supported best format

@ronny
ronny / Dockerfile
Created March 4, 2017 06:31
mxnet 0.9.3a dockerfile - ubuntu 16.04
# Originally from https://github.com/dmlc/mxnet/tree/master/docker
# by Mu Li <muli@cs.cmu.edu>
FROM ubuntu:16.04
LABEL version="0.9.3a" \
website="https://mxnet.io" \
repository="https://github.com/dmlc/mxnet" \
tags="machine-learning, deep-learning, deep-neural-networks, distributed-systems"
#!/bin/bash
jq --version | grep "^jq-" >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "Make sure 'jq' is installed. e.g. 'brew install jq'"
exit 1
fi
aws --version 2>&1 | grep "^aws-cli" >/dev/null 2>&1
if [ $? -ne 0 ]; then
@ronny
ronny / publishing-npm-package.md
Last active April 13, 2020 07:59
Publishing an NPM package

Building

Stolen from rackt/redux.

Relevant package.json snippet:

  "build:lib": "babel src --out-dir lib",
  "build:umd": "webpack src/index.js dist/my-pkg-name.js --config webpack.config.development.js",
 "build:umd:min": "webpack src/index.js dist/my-pkg-name.min.js --config webpack.config.production.js",

Docker on Mac OS X

These are my notes based on my experience with using Docker on Mac OS X.

Assumptions

If these assumptions are not true for you, then this document may not be for you.

I assume you have these installed:

  • recent-ish Mac OS X
@ronny
ronny / keybase.md
Last active November 15, 2017 02:08

Keybase proof

I hereby claim:

  • I am ronny on github.
  • I am ronny (https://keybase.io/ronny) on keybase.
  • I have a public key ASC9qo4A1mOwUHk_BhKvc4p6NMbbb18iSwmbxTyQg4xyego

To claim this, I am signing this object:

@ronny
ronny / cheryl.clj
Last active August 29, 2015 14:19
Cheryl's Birthday
;; http://www.theguardian.com/science/alexs-adventures-in-numberland/2015/apr/13/can-you-solve-the-singapore-primary-maths-question-that-went-viral
(def possible-dates
(sorted-set
[5 15] [5 16] [5 19]
[6 17] [6 18]
[7 14] [7 16]
[8 14] [8 15] [8 17]))
;; Albert was told the month. Bernard was told the day of month.
@ronny
ronny / aes_crypt.rb
Last active August 29, 2015 14:05
AES symmetric-key encryption/decryption in Ruby with the built-in OpenSSL lib
require 'openssl'
require 'digest/sha2'
module AESCrypt
CIPHER_TYPE = "AES-256-CBC".freeze
class << self
def decrypt(armored_iv_and_ciphertext, key)
ciphertext = [armored_iv_and_ciphertext].pack("H*")
aes = OpenSSL::Cipher::Cipher.new(CIPHER_TYPE)