Skip to content

Instantly share code, notes, and snippets.

View slidenerd's full-sized avatar

slidenerd slidenerd

View GitHub Profile
@daliborgogic
daliborgogic / default.vue
Last active October 16, 2020 17:59
Vantablack? Nuxt.js simple theme switch
<script>
export default {
computed: {
theme () {
const [color, backgroundColor] = this.$store.state.theme
return {
'--color': color,
'--background-color': backgroundColor
}
}
@calvinh8
calvinh8 / 1.mongodb-aws-setup-guide.md
Last active November 24, 2023 10:00
MongoDB Setup Guide for AWS EC2 Instances with Auth Enabled

MongoDB AWS EC2 Setup Guide

You can see my latest update in my blog here https://medium.com/@calvin.hsieh/steps-to-install-mongodb-on-aws-ec2-instance-62db66981218

Credits:

Big thanks to Elad Nava and Shane Rainville for writing the above articles that allow me to conduct this guide. If by all means that I violated original post's copyright, please contact me.

@denji
denji / nginx-tuning.md
Last active April 26, 2024 11:21
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.

@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@joshbirk
joshbirk / samplerest.js
Created February 3, 2012 19:57
Sample of using passport w/ mult strategies
var fs = require("fs")
var ssl_options = {
key: fs.readFileSync('privatekey.pem'),
cert: fs.readFileSync('certificate.pem')
};
var port = process.env.PORT || 3000;
var express = require('express');
var ejs = require('ejs');
var passport = require('passport')