Skip to content

Instantly share code, notes, and snippets.

View owen800q's full-sized avatar

owen800q

  • Singapore
View GitHub Profile
@owen800q
owen800q / java packaging cheat sheet.txt
Last active February 19, 2019 10:20
Java package cheatsheet
Package a java project with maven plugin
pom.xml
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging> //here jar can be change to war depdends on what project is
<build>
<plugins>
<plugin>
@owen800q
owen800q / nodejs-cheatsheet.js
Created March 6, 2019 07:27 — forked from LeCoupa/nodejs-cheatsheet.js
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@owen800q
owen800q / nginx-tuning.md
Created March 6, 2019 07:27 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@owen800q
owen800q / nginxproxy.md
Created March 6, 2019 07:27 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@owen800q
owen800q / nginxproxy.md
Created March 6, 2019 07:27 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@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())
@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 &gt; 38fd165b.0 
@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 / 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: