Skip to content

Instantly share code, notes, and snippets.

View owen800q's full-sized avatar

owen800q

  • Singapore
View GitHub Profile
@owen800q
owen800q / boringssl.md
Created June 22, 2020 07:16
boringssl library's ssl pinning bypass

function bytes sequence signature

arm 32

2D E9 F0 4F A3 B0 81 46 50 20 10 70 D9 F8 98 70 00 2F

arm 64

FF 03 05 D1 FC 6B 0F A9 F9 63 10 A9 F7 5B 11 A9 F5 53 12 A9 F3 7B 13 A9 08 0A 80 52 48 00 00 39 16 54 40 F9 56 07 00 B4 C8 02 40 F9 08 07 00 B4 29 20 40 A9 F3 03 02 AA
@owen800q
owen800q / async_await_best_practices_cheatsheet.md
Created March 23, 2020 08:59 — forked from jonlabelle/async_await_best_practices_cheatsheet.md
C# Asynchronous Programming Guideline Cheat Sheet

Async Await Best Practices Cheat Sheet

Summary of Asynchronous Programming Guidelines

Name Description Exceptions
Avoid async void Prefer async Task methods over async void methods Event handlers
Async all the way Don't mix blocking and async code Console main method
Configure context Use ConfigureAwait(false) when you can Methods that require con­text
@owen800q
owen800q / git cheatsheet.md
Created October 24, 2019 03:47
Git_cheatsheet.md

Show Nth commit logs from the beginning

Example, Show first 4 commit histroies from first inital commit

it log  --pretty=oneline | tail -n 4

Output

@owen800q
owen800q / System Design.md
Created October 24, 2019 03:44 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@owen800q
owen800q / Flask_deployment.md
Last active September 19, 2019 09:20
Flask deployment
 uwsgi --socket 0.0.0.0:5000 --plugin python --protocol=http --wsgi-file wsgi.py 
open("/usr/lib/uwsgi/plugins/python_plugin.so"): No such file or directory [core/utils.c line 3691]
!!! UNABLE to load uWSGI plugin: /usr/lib/uwsgi/plugins/python_plugin.so: cannot open shared object file: No such file or directory !!!
uwsgi: unrecognized option '--wsgi-file'
getopt_long() error

Solution:

@owen800q
owen800q / Call go functions in Python.md
Last active September 16, 2019 05:12
Call go functions in Python

Method 1:

Using socket, build go as a server. From python, pass parameter over socket connection and get results from go server.

Method 2:

Compile Go to shared object library, call from python with ctypes

sample code

@owen800q
owen800q / How to solve Teamviewer GUI not starting on Ubuntu 18.04.md
Created September 14, 2019 03:55
How to solve Teamviewer GUI not starting on Ubuntu 18.04
Init...
CheckCPU: SSE2 support: yes
Checking setup...
Launching TeamViewer ...
Launching TeamViewer GUI ...

then the windows does not pop out

Solution:

@owen800q
owen800q / help.py
Last active August 27, 2019 09:29
SQLAlchemy helper functions
# Convert nested model object to dict
def my_dict(obj):
if not hasattr(obj,"__dict__"):
return obj
result = {}
for key, val in obj.__dict__.items():
if key.startswith("_") and key == 'metadata':
continue
element = []
@owen800q
owen800q / AddCertToAndroidSystem.md
Last active October 29, 2020 23:58
Add any cert to android 7.0 or above system store

Here I use the cert issued by charles proxy as example

openssl x509 -inform PEM -subject_hash_old -in ~/.charlesproxy/charles.pem | head -1

returned hash code -> 38fd165b

cat ~/.charlesproxy/charles.pem > 38fd165b.0 
@owen800q
owen800q / crud.py
Last active August 1, 2019 05:28
SQLAlchemy repository pattern example
## Model classes
class Book(Base):
__tablename__ = 'books'
id = Column(Integer,primary_key = True)
book_id = Column(Integer,unique = True)
title = Column(String, nullable = False)
author = Column(String,index = True)
created_date = Column(DateTime,server_default = func.now())