-H '([a-z\-]*): ([^']*)'
->
'\1' : '\2', \r\n
This file contains 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
def mail_body_decode(message): | |
for part in email.header.decode_header(message): | |
binary, charset = part | |
if isinstance(binary, str): | |
yield str(binary) | |
else: | |
dammit = UnicodeDammit(binary, ['utf8', 'gb2312'] + [charset]) | |
decoded_str = dammit.unicode_markup | |
yield decoded_str |
This file contains 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
<!-- | |
Copyright 2017 Vinzenz Feenstra, Red Hat, Inc. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
This file contains 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 os | |
from scrapyd.eggstorage import FilesystemEggStorage | |
from scrapyd.config import Config | |
import urllib2 | |
from poster.encode import multipart_encode | |
from poster.streaminghttp import register_openers | |
register_openers() | |
source_dir = '/kf/scrapyd' |
This file contains 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
sudo groupadd docker | |
sudo usermod -aG docker $USER | |
newgrp docker |
This file contains 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
#!/bin/sh | |
# size of swapfile in megabytes | |
swapsize=1024 | |
# does the swap file already exist? | |
grep -q "swapfile" /etc/fstab | |
# if not then create it | |
if [ $? -ne 0 ]; then |
This file contains 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
7z a -tzip ..\app.zip . -xr!log |
This file contains 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 os | |
import yaml | |
import logging.config | |
import logging | |
import coloredlogs | |
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'): | |
""" | |
| **@author:** Prathyush SP | |
| Logging Setup |
This file contains 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
# /etc/profile.d/python3.sh | |
PATH=$PATH:/usr/local/bin |
This file contains 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 datetime | |
from decimal import Decimal | |
import six | |
try: | |
from django.utils.encoding import DjangoUnicodeDecodeError | |
except ImportError: | |
class DjangoUnicodeDecodeError(UnicodeDecodeError): |