Skip to content

Instantly share code, notes, and snippets.

View zhangyangyu's full-sized avatar
🏠
Working from home

Xiang Zhang zhangyangyu

🏠
Working from home
View GitHub Profile
<?php
declare(strict_types=1);
namespace dacoto\LaravelWizardInstaller\Controllers;
use dacoto\EnvSet\EnvSetEditor;
use Exception;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
@zhangyangyu
zhangyangyu / classic-eventlet-sample.png
Last active December 14, 2018 15:47
A snippet to generate a graphviz graph showing the inheritance of all the greenlets inside a process. Use commands like `dot -Gdpi=300 -Tpng 1.gv -o 1.png` to generate the graph from the output.
classic-eventlet-sample.png
@zhangyangyu
zhangyangyu / cpython2.7-dynamicattach.diff
Last active June 19, 2018 08:13
Java like dynamic attaching mechanism in CPython 2.7 on Linux
diff --git a/root/Python-2.8.1/Modules/signalmodule.c b/./Modules/signalmodule.c
index 184b3a9..e5ede43 100644
--- a/root/Python-2.8.1/Modules/signalmodule.c
+++ b/./Modules/signalmodule.c
@@ -6,6 +6,8 @@
#include "Python.h"
#include "intrcheck.h"
+#include "frameobject.h"
+
@zhangyangyu
zhangyangyu / cpython@5a9820918077a65db90f24733edc8935c3e2130e.diff
Created June 12, 2018 10:33
Try to avoid the temporary string variable while creating an interned string. But doesn't really help overall CPython performance. :-(
diff --git a/tmp/cpython-master/Include/unicodeobject.h b/./Include/unicodeobject.h
index 0274de6..a1712ee 100644
--- a/tmp/cpython-master/Include/unicodeobject.h
+++ b/./Include/unicodeobject.h
@@ -1014,6 +1014,7 @@ PyAPI_FUNC(PyObject *) PyUnicode_InternFromString(
const char *u /* UTF-8 encoded string */
);
#ifndef Py_LIMITED_API
+PyAPI_FUNC(PyObject *) _PyUnicode_InternFromASCIIString(const char *u);
PyAPI_FUNC(void) _Py_ReleaseInternedUnicodeStrings(void);