- https://medium.com/making-instapaper/instapaper-outage-cause-recovery-3c32a7e9cc5f#.8wd4ufmw5
- https://blogs.dropbox.com/tech/2014/01/outage-post-mortem/
- https://groups.google.com/forum/#!topic/google-appengine/p2QKJ0OSLc8
- https://about.gitlab.com/2017/02/10/postmortem-of-database-outage-of-january-31/
- https://blog.cloudflare.com/todays-outage-post-mortem-82515/
- https://github.com/blog/1759-dns-outage-post-mortem
- https://blog.travis-ci.com/2017-02-07-jan-31-macos-outage-postmortem
- http://stackstatus.net/post/147710624694/outage-postmortem-july-20-2016
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 timeout_function(timeout, force_clean_func): | |
def decorator_timeout_function(func): | |
@functools.wraps(func) | |
def run_func_in_thread(*args, **kwargs): | |
thread = threading.Thread(target=func, args=args, kwargs=kwargs) | |
thread.start() | |
thread.join(timeout) | |
if thread.is_alive(): | |
print("timeout, begin to call force_clean_func") | |
force_clean_func() |
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 tempfile | |
from bottle import route, request, static_file, run | |
import win32com | |
from win32com.client import * | |
word = win32com.client.Dispatch("Word.Application") | |
word.visible = 1 | |
@route('/convert', method='POST') |
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
You can add the <DockerfileRunArguments> tag to the <PropertyGroup> section in your *.csproj file and put additional run parameters there. | |
e.g. | |
<Project Sdk="Microsoft.NET.Sdk.Web"> | |
<PropertyGroup> | |
<DockerfileRunArguments>-p 5000:6000</DockerfileRunArguments> | |
</PropertyGroup> | |
</Project> |
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
# Set the locale | |
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ | |
locale-gen | |
ENV LANG en_US.UTF-8 | |
ENV LANGUAGE en_US:en | |
ENV LC_ALL en_US.UTF-8 |
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
class MultiProcessingLog(logging.Handler): | |
def __init__(self, log_file_name, when, backupCount): | |
logging.Handler.__init__(self) | |
self._handler = TimedRotatingFileHandler(log_file_name, when=when, backupCount=backupCount) | |
self.queue = multiprocessing.Queue(-1) | |
t = threading.Thread(target=self.receive) | |
t.daemon = True | |
t.start() |
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
var path = @"C:\Users\lmatt\Desktop\MTTest\MT Test 02.docx.xlf"; | |
XmlNamespaceManager namespaceManager = new XmlNamespaceManager(new NameTable()); | |
namespaceManager.AddNamespace("prefix", "urn:oasis:names:tc:xliff:document:1.2"); | |
var xelement = XElement.Load(path); | |
xelement.XPathSelectElements("//prefix:seg-source/prefix:mrk", namespaceManager).Select(e => e.Value).Dump(); |
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
from graphviz import Digraph | |
import json | |
def generate_sub_graph(sub_graph_name, digraph, sub_data_json): | |
with digraph.subgraph(name="cluster_" + sub_graph_name, edge_attr={'arrowhead': 'none'}) as c: | |
data_len = len(sub_data_json) | |
edges = [] | |
c.node(sub_graph_name + str(data_len), label=sub_graph_name + "_sentence_end") | |
for i in range(data_len): | |
c.node(sub_graph_name + str(data_len - i - 1), label=sub_data_json[data_len - i - 1]) |
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
[ | |
"html", | |
"head", | |
"title", | |
"base", | |
"link", | |
"meta", | |
"style", | |
"script", | |
"noscript", |
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
#bindkey -v | |
bindkey '\eOH' beginning-of-line | |
bindkey '\eOF' end-of-line |
NewerOlder