Skip to content

Instantly share code, notes, and snippets.

View jun66j5's full-sized avatar
💬

Jun Omae (大前 潤) jun66j5

💬
  • OpenGroove,Inc.
  • Tokyo, Japan
View GitHub Profile
@jun66j5
jun66j5 / py38-py_ssize_t.diff
Created November 5, 2019 11:16
Avoid deprecation warnings about PY_SSIZE_T_CLEAN since Python 3.8
Index: subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
===================================================================
--- subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (revision 1869386)
+++ subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c (working copy)
@@ -23,6 +23,8 @@
/* Tell swigutil_py.h that we're inside the implementation */
#define SVN_SWIG_SWIGUTIL_PY_C
+/* Avoid deprecation warnings about PY_SSIZE_T_CLEAN since Python 3.8 */
+#define PY_SSIZE_T_CLEAN
commit 0b5193e8415d0d1504e99dfa013c0886b697f5a3
Author: Jun Omae <jun66j5@gmail.com>
Date: Tue Oct 29 13:06:55 2019 +0900
Support building with SWIG 4 on Python 2 and 3
diff --git a/build/ac-macros/swig.m4 b/build/ac-macros/swig.m4
index 2fb5e49fb..358389bd0 100644
--- a/build/ac-macros/swig.m4
+++ b/build/ac-macros/swig.m4
@jun66j5
jun66j5 / check-swig-py.log
Created October 21, 2019 06:18
check-swig-py (swig-py3@1868674, python 3.7.4)
if [ "LD_LIBRARY_PATH" = "DYLD_LIBRARY_PATH" ]; then for d in /home/jun66j5/src/subversion/swig-py3/subversion/bindings/swig/python/libsvn_swig_py /home/jun66j5/src/subversion/swig-py3/subversion/bindings/swig/python/../../../libsvn_*; do if [ -n "$DYLD_LIBRARY_PATH" ]; then LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$d/.libs"; else LD_LIBRARY_PATH="$d/.libs"; fi; done; export LD_LIBRARY_PATH; fi; \
cd /home/jun66j5/src/subversion/swig-py3/subversion/bindings/swig/python; \
/usr/bin/python3.7 /home/jun66j5/src/subversion/swig-py3/subversion/bindings/swig/python/tests/run_all.py
...............F..............EEFEEE.E.EE..FEF.........E..EE..FFEF....FF..FE...EE.E..FF.E......EF.E.......FFE/usr/lib/python3.7/unittest/case.py:656: ResourceWarning: unclosed file <_io.BufferedReader name='/home/jun66j5/src/subversion/swig-py3/subversion/bindings/swig/python/tests/trac/versioncontrol/tests/svnrepos.dump'>
outcome.errors.clear()
ResourceWarning: Enable tracemalloc to get the object allocation traceback
E....................
@jun66j5
jun66j5 / avoid-c4115-r1868290.diff
Created October 17, 2019 06:22
Avoid C4115 from uses `struct time *` in pytime.h
Index: subversion/bindings/swig/include/svn_global.swg
===================================================================
--- subversion/bindings/swig/include/svn_global.swg (revision 1868505)
+++ subversion/bindings/swig/include/svn_global.swg (working copy)
@@ -34,6 +34,7 @@
#ifdef SWIGPYTHON
%begin %{
#define SWIG_PYTHON_STRICT_BYTE_CHAR
+struct timeval; /* avoid C4115 from uses `struct time *` in pytime.h */
%}
@jun66j5
jun66j5 / JetsamEvent-2019-05-25-020155.ips
Created May 24, 2019 17:05
JetsamEvent-2019-05-25-020155.ips
{"bug_type":"298","timestamp":"2019-05-25 02:01:55.21 +0900","os_version":"iPhone OS 12.3 (16F156)","incident_id":"E154989B-CA6D-4048-B67A-BC9B6DED3E8D"}
{
"crashReporterKey" : "f438541506f0b93f535f41195820f2df3a19e5f5",
"kernel" : "Darwin Kernel Version 18.6.0: Thu Apr 25 22:14:03 PDT 2019; root:xnu-4903.262.2~2\/RELEASE_ARM64_T7000",
"product" : "iPod7,1",
"incident" : "E154989B-CA6D-4048-B67A-BC9B6DED3E8D",
"date" : "2019-05-25 02:01:55.19 +0900",
"build" : "iPhone OS 12.3 (16F156)",
"timeDelta" : 59,
"memoryStatus" : {
@jun66j5
jun66j5 / diff
Last active March 15, 2019 11:32
Respect "stime" parameter of screen view in zabbix web
--- /usr/share/zabbix/include/classes/screens/CScreenGraph.php.orig 2019-03-15 20:21:20.892689484 +0900
+++ /usr/share/zabbix/include/classes/screens/CScreenGraph.php 2019-03-15 20:21:31.759473860 +0900
@@ -143,7 +143,7 @@
.'&graph3d='.$graph3d.$this->getProfileUrlParams();
$timeControlData['src'] .= ($this->mode == SCREEN_MODE_EDIT)
? '&period=3600&stime='.date(TIMESTAMP_FORMAT, time())
- : '&period='.$this->timeline['period'].'&stime='.$this->timeline['stimeNow'];
+ : '&period='.$this->timeline['period'].'&stime='.$this->timeline['stime'];
}
else {
@jun66j5
jun66j5 / another-workaround.diff
Last active January 23, 2019 03:22
check-swig-py failing...
diff --git a/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c b/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
index d3372b08a..0a6668f50 100644
--- a/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
+++ b/subversion/bindings/swig/python/libsvn_swig_py/swigutil_py.c
@@ -3134,7 +3134,10 @@ void svn_swig_py_status_func2(void *baton,
/* Our error has no place to go. :-( */
if (err)
- svn_error_clear(err);
+ {
@jun66j5
jun66j5 / svnrepos.dmp
Last active November 27, 2018 09:50
Incorrect utf-8 sequences in properties of Subversion repository
SVN-fs-dump-format-version: 2
UUID: f31ea3d8-4a9a-41a8-b50c-f56620caf647
Revision-number: 0
Prop-content-length: 56
Content-length: 56
K 8
svn:date
@jun66j5
jun66j5 / windows-systime.py
Created January 12, 2016 11:20
High-resolution system time on Windows 8+ and Windows Server 2012+
from ctypes import Structure, pointer, windll
from ctypes.wintypes import DWORD, WORD
from datetime import datetime
class FILETIME(Structure):
_fields_ = [('dwLowDateTime', DWORD),
('dwHighDateTime', DWORD)]
_kernel32 = windll.kernel32
GetLastError = _kernel32.GetLastError
@jun66j5
jun66j5 / main.m
Last active July 25, 2021 08:58
Redirect stdout/stderr to NSLog on iOS Simulator
#include <unistd.h>
static int redirect_nslog(const char *prefix, const char *buffer, int size)
{
NSLog(@"%s (%d bytes): %.*s", prefix, size, size, buffer);
return size;
}
static int stderr_redirect_nslog(void *inFD, const char *buffer, int size)
{