Skip to content

Instantly share code, notes, and snippets.

Cory Benfield Lukasa

Block or report user

Report or block Lukasa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Lukasa
Lukasa / unsafely.txt
Created Jul 10, 2019
Thread unsafe Swift issue
View unsafely.txt
==================
WARNING: ThreadSanitizer: Swift access race (pid=7)
Read of size 8 at 0x7b240000bd80 by thread T11:
#0 Credentials.UserProfile.extendedProperties.getter : [Swift.String : Any] ??:? (Main+0xba2d6)
#1 static Server.AccountType.for(userProfile: Credentials.UserProfile) -> Server.AccountType? /root/Apps/SyncServerII/SyncServerII/Sources/Server/Account Specifics/Account.swift:138 (Main+0x669485)
#2 Server.AccountManager.accountFromProfile(profile: Credentials.UserProfile, user: Server.AccountCreationUser?, delegate: Server.AccountDelegate?) -> Server.Account? /root/Apps/SyncServerII/SyncServerII/Sources/Server/Account Specifics/AccountManager.swift:86 (Main+0x67362f)
#3 Server.RequestHandler.doRequest(createRequest: (Kitura.RouterRequest) -> SyncServerShared.RequestMessage?, processRequest: (Server.RequestProcessingParameters) -> ()) -> () /root/Apps/SyncServerII/SyncServerII/Sources/Server/Setup/RequestHandler.swift:406 (Main+0x84748b)
#4 handleRequest #1 (routerRequest: K
@Lukasa
Lukasa / fix.patch
Created Apr 24, 2017
Short read fix.
View fix.patch
commit ebef3775f0ab40820f5a118b632d5e1f0c7d1121
Author: Cory Benfield <lukasaoz@gmail.com>
Date: Mon Apr 24 17:23:29 2017 +0100
Read short on EOF
diff --git a/urllib3/contrib/securetransport.py b/urllib3/contrib/securetransport.py
index 84d213f..cd840a6 100644
--- a/urllib3/contrib/securetransport.py
+++ b/urllib3/contrib/securetransport.py
@Lukasa
Lukasa / LICENSE
Last active Feb 24, 2017
AirPods via Twilio
View LICENSE
Copyright (c) 2017 Cory Benfield
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
View test.py
class MyConnectionPool(HTTPSConnectionPool):
# This does not affect the value of HTTPSConnectionPool.ConnectionCls
ConnectionCls = Whatever
@Lukasa
Lukasa / cert_builder.py
Created Feb 17, 2017
Copy a certificate using cryptography
View cert_builder.py
# -*- coding: utf-8 -*-
"""
A script that takes a path to a given cert and key and rebuilds them in new
files.
"""
import sys
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives import hashes, serialization
@Lukasa
Lukasa / output.txt
Last active Nov 6, 2016
Pytest help output
View output.txt
(py35) cory@heimdall:hyper-h2/ % py.test --help
usage: py.test [options] [file_or_dir] [file_or_dir] [...]
positional arguments:
file_or_dir
general:
-k EXPRESSION only run tests which match the given substring
expression. An expression is a python evaluatable
expression where all names are substring-matched
View README.md

To run this benchmark, clone this gist, cd into the directory, and then run tox. This will print a set of results.

@Lukasa
Lukasa / test.py
Created Sep 2, 2016
Demonstrate nginx's failings
View test.py
import socket
import ssl
import time
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
TARGET = ('67.205.133.224', 443)
@Lukasa
Lukasa / loop.py
Created Aug 15, 2016
Is this an event loop?
View loop.py
from __future__ import print_function
def socket_loop(sock):
while True:
data = sock.recv(8192)
print(data)
if not data:
break
@Lukasa
Lukasa / test.py
Created Aug 15, 2016
Blue or Red?
View test.py
from twisted.internet.protocol import Protocol
class PrinterProtocol(Protocol):
def connectionMade(self, transport):
self.transport = transport
self.response = b''
self.transport.write(
b'GET / HTTP/1.1\r\n'
b'Host: http2bin.org\r\n'
b'Connection: close\r\n'
You can’t perform that action at this time.