This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| A flask like reloader function for use with txweb | |
| In user script it must follow the pattern | |
| def main(): | |
| my main func that starts twisted | |
| if __name__ == "__main__": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /***************************************************************** | |
| * onMessage from the extension or tab (a content script) | |
| *****************************************************************/ | |
| chrome.runtime.onMessage.addListener( | |
| function(request, sender, sendResponse) { | |
| if (request.cmd == "any command") { | |
| sendResponse({ result: "any response from background" }); | |
| } else { | |
| sendResponse({ result: "error", message: `Invalid 'cmd'` }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Dislaimer | |
| ######### | |
| I've been using Komodo IDE since the mid-90's but I AM NOT AN ACTIVE STATE EMPLOYEE. This is on your ownware with a I don't care license. | |
| No warranty of the code is offered, read the code, and only install it if you understand what it does. | |
| Semi-rant | |
| ######### | |
| Pre-retirement, it was my in-house rule that all projects used virtualenv. It made it easier to `pip freeze > requirements.txt` | |
| dependancies. Last thing I ever wanted to experience was having a "Oh my god everything is broken" call and spend an hour reverse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Features | |
| -------- | |
| A demonstration of some of the built-in Natural Earth features found | |
| in cartopy. | |
| modified from caropy examples/features.py | |
| """ | |
| __tags__ = ['Lines and polygons'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var express = require('express'), | |
| app = express(), | |
| http = require('http'), | |
| server = http.createServer(app), | |
| path = require('path'), | |
| io = require('socket.io').listen(server), | |
| fs = require('fs'), | |
| zmq = require('zmq'), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Command line output | |
| ================================= | |
| Test with both arguments supplied | |
| Handling call | |
| Parameter name: always_int | |
| Parameter name: always_str | |
| Original position arguments: ('123',) | |
| Original keyword arguments: {'always_str': 345} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import ctypes, sys | |
| from ctypes import windll, wintypes | |
| from uuid import UUID | |
| class GUID(ctypes.Structure): # [1] | |
| _fields_ = [ | |
| ("Data1", wintypes.DWORD), | |
| ("Data2", wintypes.WORD), | |
| ("Data3", wintypes.WORD), | |
| ("Data4", wintypes.BYTE * 8) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "vars": { | |
| "@gray-darker": "lighten(#000, 13.5%)", | |
| "@gray-dark": "lighten(#000, 20%)", | |
| "@gray": "lighten(#000, 33.5%)", | |
| "@gray-light": "lighten(#000, 46.7%)", | |
| "@gray-lighter": "lighten(#000, 93.5%)", | |
| "@brand-primary": "#428bca", | |
| "@brand-success": "#5cb85c", | |
| "@brand-info": "#5bc0de", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import email | |
| def get_decoded_email_body(message_body): | |
| """ Decode email body. | |
| Detect character set if the header is not set. | |
| We try to get text/plain, but if there is not one then fallback to text/html. | |
| :param message_body: Raw 7-bit message body input e.g. from imaplib. Double encoded in quoted-printable and latin-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """ | |
| Recipe for creating and updating security groups programmatically. | |
| """ | |
| import collections | |
| import boto |