Skip to content

Instantly share code, notes, and snippets.

View teochengyong's full-sized avatar

Cheng Yong teochengyong

View GitHub Profile
@teochengyong
teochengyong / nginx-tuning.md
Created June 4, 2019 06:55 — 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.

@teochengyong
teochengyong / server.js
Last active June 10, 2018 13:44
Using express to serve Angular App
const express = require('express');
const compression = require('compression')
const path = require('path');
const app = express()
app.use(compression());
const port = process.env.PORT || 8080;
// static file serve
const dirName = 'dist'
app.use(express.static(path.resolve(`${dirName}`)))
// not found in static files, so default to index.html
@teochengyong
teochengyong / CheckPortAndKill.sh
Last active February 22, 2018 03:17
Identify which services are running on the tcp post
#Command to check which services are running on that particular tcp port
sudo lsof -i tcp:4200
#kill the task
kill -9 {{pid}}
@teochengyong
teochengyong / gist:e72f2dd47b48362cfd3c2adeb5e64db6
Last active November 22, 2018 03:39
Git log to prettify commits between tags for release note
git log REPLACE_TAG1..master --no-merges --reverse --pretty=format:"%h %an: %s"
@teochengyong
teochengyong / app.module.ts
Created October 30, 2017 10:36 — forked from saschwarz/app.module.ts
Rollbar JS in Angular 4/Typescript
...
import { RollbarService, RollbarErrorHandler, rollbarFactory } from './rollbar';
@NgModule({
...
providers: [
{
provide: ErrorHandler,
useClass: RollbarErrorHandler
},
@teochengyong
teochengyong / programs by port
Created September 26, 2017 06:50
Listing programs by port in Mac
lsof -i :<portNumber>
@teochengyong
teochengyong / gh-pages-deploy.md
Created July 23, 2017 09:32 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@teochengyong
teochengyong / auto-deploy.md
Created July 23, 2017 09:23 — forked from domenic/0-github-actions.md
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with Travis

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

Create a compile script

You want a script that does a local compile to e.g. an out/ directory. Let's call this compile.sh for our purposes, but for your project it might be npm build or gulp make-docs or anything similar.

The out/ directory should contain everything you want deployed to gh-pages. That almost always includes an index.html.

@teochengyong
teochengyong / introrx.md
Created July 12, 2017 03:40 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@teochengyong
teochengyong / Data Resources
Last active February 6, 2017 03:34
Data Visualization Note
Tabular Tools
**Better Tabular Data**
https://medium.com/mission-log/design-better-data-tables-430a30a00d8c#.s008urso5
Tools
https://github.com/handsontable/handsontable
http://demos.telerik.com/kendo-ui/grid/virtualization-local-data
**Airbnb Superset**
https://github.com/airbnb/superset