Skip to content

Instantly share code, notes, and snippets.

View dpnova's full-sized avatar
🥸

David Novakovic dpnova

🥸
View GitHub Profile
import cats.effect._
import cats.implicits._
import natchez.Trace.Implicits.noop
import skunk._
import skunk.codec.all._
import skunk.implicits._
object CommandExample extends IOApp {
// a source of sessions
java.nio.channels.ShutdownChannelGroupException: null
at java.base/sun.nio.ch.Invoker.invokeIndirectly(Invoker.java:223)
at java.base/sun.nio.ch.Invoker.invoke(Invoker.java:189)
at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.write(AsynchronousSocketChannelImpl.java:370)
at java.base/sun.nio.ch.AsynchronousSocketChannelImpl.write(AsynchronousSocketChannelImpl.java:400)
at fs2.io.tcp.SocketGroup.$anonfun$apply$18(SocketGroup.scala:306)
at fs2.io.tcp.SocketGroup.$anonfun$apply$18$adapted(SocketGroup.scala:299)
at cats.effect.IO$.$anonfun$async$1(IO.scala:1206)

Keybase proof

I hereby claim:

  • I am dpnova on github.
  • I am dpn (https://keybase.io/dpn) on keybase.
  • I have a public key ASAHBz9h1MqZVDfWa0SuQAEbrhc8eTjrkSYuQkzBzIVvBwo

To claim this, I am signing this object:

"""
Dump current deferred state.
> Anyway, given a tree of deferreds, this will produce a whatever.dot
> file, which can be fed to graphviz' "dot -Tpdf whatever.dot >
> whatever.pdf", >and the pdf has a rather nice-looking graph of the
> deferreds.
http://twistedmatrix.com/pipermail/twisted-python/2012-July/025867.html
>>> class Bar:
... def __init__(self):
... print "bar init"
...
>>> @attr.s
... class Foo(Bar, object):
... something = attr.ib()
...
>>> Foo("something")
Foo(something='something')
@patch(ASYNC_MODULE + 'identify_lines')
def test_lines_get_read(self, il):
_identify_url_file(tests.VALID_FILE)
il.assert_called_with(foo)
@dpnova
dpnova / udevprotocol.py
Created February 19, 2015 03:07
udev and twisted together. repasting from: http://pastebin.com/TnrsS15s by @ralphm
import pyudev
from twisted.internet import abstract
class UDevMonitor(abstract.FileDescriptor):
"""
Protocol wrapper for pyudev.Monitor.
@see: U{http://packages.python.org/pyudev/api/monitor.html}.
"""
@dpnova
dpnova / hack.py
Last active August 29, 2015 14:13
"""
This is a hack to stop verification which seems to block.
This shouldn't ever make it to prod!!!
"""
from logging import getLogger
from OpenSSL.SSL import Connection
Connection.set_tlsext_host_name = lambda s, n: None
getLogger(__name__).warning(
"Currently we are vulnerable to MITM attacks: "
Source/WebKit/gtk/webkit/webkitversion.h:37: Warning: WebKit: symbol='WEBKITGTK_API_VERSION': Unknown namespace for symbol 'WEBKITGTK_API_
VERSION'
./libtool: line 3077: warning: setlocale: LC_CTYPE: cannot change locale (en_AU.UTF-8)

Keybase proof

I hereby claim:

  • I am dpnova on github.
  • I am dpn (https://keybase.io/dpn) on keybase.
  • I have a public key whose fingerprint is 0CE0 E1B2 87BD B761 9B1D 2D76 7A86 EEEC 0EF0 A90E

To claim this, I am signing this object: