Skip to content

Instantly share code, notes, and snippets.

@OrangeDog
OrangeDog / Failing case (0.6.9)
Created February 2, 2012 15:03
Attachments for joyent/node issue: Large file downloads failing in 0.6.9
Node server (8301) to curl client (44366)
HTTP/1.1 200 OK
Content-Type: application/zip
Content-Disposition: attachment; filename="bigFile.zip"
Content-Length: 10001676
Last-Modified: Thu, 02 Feb 2012 11:50:07 UTC
Connection: keep-alive
PK....... etc.
@OrangeDog
OrangeDog / server.js
Last active December 21, 2015 12:29
Node.JS - Connection:close behaviour changed between 0.8.x and 0.10.x
require('http').createServer(function(req, resp) {
console.log('start', req.connection.remoteAddress, req.connection.remotePort);
resp.end();
console.log('end', req.connection.remoteAddress, req.connection.remotePort);
}).listen(5000);
@OrangeDog
OrangeDog / setup.py
Last active July 11, 2018 10:19
Example python sub-package
from setuptools import setup
setup(
name='test-dep-two',
version='1.0',
install_requires=['pytz']
)
@OrangeDog
OrangeDog / setup.py
Last active July 11, 2018 10:20
Example python package
from setuptools import setup
setup(
name='test-dep-one',
version='1.0',
install_requires=[
'python-dateutil',
'test-dep-two'
],
dependency_links=[
@OrangeDog
OrangeDog / x509.py
Created May 7, 2019 13:07
Custom implementation of salt.states.x509
import salt.states.x509
from salt.states.x509 import *
from salt.states.x509 import _get_file_args
del certificate_managed
def __init__(opts):
salt.states.x509.__salt__ = __salt__
salt.states.x509.__states__ = __states__
--- salt/client/mixins.py
+++ salt/client/mixins.py
@@ -10,8 +10,8 @@
import logging
import weakref
import traceback
-import collections
import copy as pycopy
+from collections.abc import Mapping, MutableMapping
@OrangeDog
OrangeDog / _modules_pg_ddl.py
Last active September 6, 2023 08:00
Stateful DDL
# Need to bypass module loader in order to access private functions
from salt.modules import postgres
def __init__(opts):
postgres.__grains__ = __grains__
postgres.__opts__ = opts
postgres.__salt__ = __salt__