Skip to content

Instantly share code, notes, and snippets.

View joshfriend's full-sized avatar

Josh Friend joshfriend

View GitHub Profile
@joshfriend
joshfriend / 20190425-android-coroutines.md
Last active April 29, 2019 04:19
Chicago Roboto 2019 notes
suspend fun thing() {
    with (dispatchers.io) {}
}

Dispatchers:

  • Main
  • IO (network/disk)

Credit to @cketti for the original steps

If you are annoyed that "Sources for Android 28" are not yet available via SDK manager, this might be for you:

  1. Collect source files
mkdir android-sdk-source-build
cd android-sdk-source-build

Session resumption: quick handshake for servers we've connected to before TLS v1.3 0-RTT session resumption

QWxhZGRpbjpPcGVuU2VzYW1l

Round trips: TLS 1.2: 2 TLS 1.2 session res: 1 TLS 1.3: 1 TLS 1.3 session res: 1 (but less data)

MergeSwiftModule normal x86_64 /Users/josh/Library/Developer/Xcode/DerivedData/BibleGateway-frdbcokjbzuqeogwilldifxmjyab/Build/Intermediates/BibleGateway.build/Debug-iphonesimulator/BibleGateway.build/Objects-normal/x86_64/BibleGateway.swiftmodule
cd /Users/josh/git/bg/ios
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-module /Users/josh/Library/Developer/Xcode/DerivedData/BibleGateway-frdbcokjbzuqeogwilldifxmjyab/Build/Intermediates/BibleGateway.build/Debug-iphonesimulator/BibleGateway.build/Objects-normal/x86_64/ContentController~partial.swiftmodule /Users/josh/Library/Developer/Xcode/DerivedData/BibleGateway-frdbcokjbzuqeogwilldifxmjyab/Build/Intermediates/BibleGateway.build/Debug-iphonesimulator/BibleGateway.build/Objects-normal/x86_64/BibleDownloadController~partial.swiftmodule /Users/josh/Library/Developer/Xcode/DerivedData/BibleGateway-frdbcokjbzuqeogwilldifxmjyab/Build/Intermediates/BibleGateway.build/Debug-iphonesimulator/Bibl
@DatabaseTable(tableName = Address.TABLE)
class Address() : BaseModel() {
companion object {
const val TABLE = "address"
const val NUMBER = "number"
const val STREET = "street"
const val DIRECTION = "direction"
const val UNIT = "unit"
const val CITY = "city"
@joshfriend
joshfriend / pokedomains.txt
Created July 25, 2016 12:44
Pokemon which happen to be valid domains
Charmander -> charmand.er
Blastoise -> blastoi.se
Caterpie -> caterp.ie
Butterfree -> butterfr.ee
Kakuna -> kaku.na
Pidgeotto -> pidgeot.to
Pikachu -> pikac.hu
Raichu -> raic.hu
Sandslash -> sandsla.sh
Nidorina -> nidori.na
@joshfriend
joshfriend / Semaphore.swift
Last active July 19, 2016 19:58
Semaphore wrapper for swift2
import Foundation
struct Semaphore {
typealias Signal = () -> Int
private let semaphore: dispatch_semaphore_t
init(count: Int = 0) {
self.semaphore = dispatch_semaphore_create(count)
@joshfriend
joshfriend / errorhandlers.py
Created May 25, 2016 20:18
Flask Error Handlers
#!/usr/bin/env python
from flask import jsonify, current_app
from werkzeug.datastructures import WWWAuthenticate
from werkzeug.http import HTTP_STATUS_CODES
from flask_principal import PermissionDenied
def _make_errorhandler(code):
FROM python:2.7.10
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y --no-install-recommends make git
#!/usr/bin/env python
from flask import current_app
from werkzeug.security import (
generate_password_hash,
check_password_hash,
DEFAULT_PBKDF2_ITERATIONS,
)