Skip to content

Instantly share code, notes, and snippets.

View Lukasa's full-sized avatar

Cory Benfield Lukasa

View GitHub Profile
@Lukasa
Lukasa / fix.patch
Created April 24, 2017 16:30
Short read fix.
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 / test.rst
Created March 23, 2016 10:37
RestructuredText Headings

First Level

Some text.

Second Level

Some text.

@Lukasa
Lukasa / unsafely.txt
Created July 10, 2019 09:14
Thread unsafe Swift issue
==================
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 / output.txt
Last active January 6, 2020 10:46
Pytest help output
(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
func x(_ body: () -> String)
func x(_ body: () -> Int)
func main() {
// do some stuff
x {
6 + "cabbages" // error is here
}
}
@Lukasa
Lukasa / README.md
Created June 1, 2015 13:42
Basic Twisted HTTP/2 client.

Simple Twisted H2 Client

This gist contains a really stupid implementation of a Twisted HTTP/2 client. It opens a connection, uses ALPN/NPN to negotiate HTTP/2, and then sends a single HTTP/2 GET request to the /ip endpoint.

To execute this:

  1. Create a clean virtual environment.
  2. Install the requirements: pip install -r requirements.txt.
  3. Install the development version of Twisted that contains the nextProtocols code.
  4. Execute the code using python h2test.py.
@Lukasa
Lukasa / example.py
Created March 31, 2013 16:28
Requests and Beautiful Soup example, following the form of http://bpaste.net/show/kMetvCdrfnzh5RgiUKU4/
from BeautifulSoup import BeautifulSoup
import requests
import urlparse
URL = 'example.com'
s = requests.Session()
def fetch(url, data=None):
if data is None:
return s.get(url).content
@Lukasa
Lukasa / netlink_ifnew.py
Created March 4, 2015 09:26
Monitor for new links using Python and Netlink