Skip to content

Instantly share code, notes, and snippets.

View wdv4758h's full-sized avatar

Chiu-Hsiang Hsu wdv4758h

View GitHub Profile

Rust/Haskell: Higher-Kinded Types (HKT)

A higher kinded type is a concept that reifies a type constructor as an actual type.

A type constructor can be thought of in these analogies:

  • like a function in the type universe
  • as a type with a "hole" in it
from zdict import zdict
from PyQt5.QtWidgets import QApplication
import sys
import signal
if __name__ == '__main__':
signal.signal(signal.SIGINT, signal.SIG_DFL)
Linux ARM32 Android ARM32 Linux ARM64 Android ARM64
AddressSanitizer O O O X
MemorySanitizer X X O X
LeakSanitizer X X O X
UndefinedBehaviorSanitizer O O O O

Android Memory Leak Profiling

前言

我們寫程式總免不了會有 bugs, 其中 Memory 相關的 bugs 佔了一大部份, 有工具可以幫我們檢查嗎?

@wdv4758h
wdv4758h / bobp-python.md
Created November 13, 2015 04:09 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
==10496== Memcheck, a memory error detector
==10496== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==10496== Using Valgrind-3.11.0.SVN and LibVEX; rerun with -h for copyright info
==10496== Command: /system/bin/app_process /system/bin --application --nice-name=com.android.browser com.android.internal.os.WrapperInit 37 16 android.app.ActivityThread
==10496== Parent PID: 10495
==10496==
==10496== Conditional jump or move depends on uninitialised value(s)
==10496== at 0x40066E4: strlen (in /system/bin/linker)
==10496== by 0x4003BF7: _start (in /system/bin/linker)
==10496== by 0x4004099: ??? (in /system/bin/linker)
@wdv4758h
wdv4758h / normal_success.log
Last active August 29, 2015 14:26
Android default browser with wrapper
adbd is already running as root
wrap.com.android.browser:
Stopping: com.android.browser
Starting: Intent { act=android.intent.action.MAIN cmp=com.android.browser/.BrowserActivity }
--------- beginning of main
W/chromium( 2156): [WARNING:resource_bundle.cc(304)] locale_file_path.empty()
I/chromium( 2156): [INFO:aw_browser_main_parts.cc(65)] Load from apk succesful, fd=33 off=46184 len=3037
I/chromium( 2156): [INFO:aw_browser_main_parts.cc(78)] Loading webviewchromium.pak from, fd:34 off:229484 len:1089587
W/AudioManagerAndroid( 2156): Requires BLUETOOTH permission
D/ ( 2156): HostConnection::get() New Host Connection established 0xb43e1750, tid 2156
@wdv4758h
wdv4758h / euler-0001-01.py
Last active August 29, 2015 14:26
Project Euler #1
print(sum(0 if x % 3 and x % 5 else x for x in range(1000)))
@wdv4758h
wdv4758h / plot.py
Created July 15, 2015 10:13
gnuplot for re2 benchlog
#!/usr/bin/env python
import sys # for argv
import subprocess # for Popen
import tempfile # for NamedTemporaryFile
import os # for remove
class gnuplot(object):
script = """
==12190== DHAT, a dynamic heap analysis tool
==12190== NOTE: This is an Experimental-Class Valgrind Tool
==12190== Copyright (C) 2010-2013, and GNU GPL'd, by Mozilla Inc
==12190== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==12190== Command: ./empty
==12190==
==12190==
==12190== ======== SUMMARY STATISTICS ========
==12190==
==12190== guest_insns: 1,002,143