Skip to content

Instantly share code, notes, and snippets.

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

@alfredochuc
alfredochuc / add_custom_column_to_edit_tag.php
Created April 22, 2020 05:38 — forked from simongcc/add_custom_column_to_edit_tag.php
Adding custom column displaying in Wordpress Manage Category/Custom Taxonomy editing page
/*
Purpose: add custom column header and custom column content to respective custom header in Manage Category Editing Page
Version Tested: 3.8
Story:
Because I found no explanation nor documents in Wordpress.org, I tried to trace the code in wp-admin folder
after understanding the operation of apply_filter(), add_action() and add_filter()
Logic:
The table list in edit_tag.php is based on
@alfredochuc
alfredochuc / functions.php
Created July 18, 2019 04:04 — forked from setola/functions.php
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown n-levels menus in Wordpress.
<?php
/**
* Extended Walker class for use with the
* Twitter Bootstrap toolkit Dropdown menus in Wordpress.
* Edited to support n-levels submenu.
* @author johnmegahan https://gist.github.com/1597994, Emanuele 'Tex' Tessore https://gist.github.com/3765640
* @license CC BY 4.0 https://creativecommons.org/licenses/by/4.0/
*/
class BootstrapNavMenuWalker extends Walker_Nav_Menu {
@alfredochuc
alfredochuc / functions.php
Created July 18, 2019 04:02 — forked from johnmegahan/functions.php
Extended Walker class for use with the Twitter Bootstrap toolkit Dropdown menus in Wordpress.
<?php
add_action( 'after_setup_theme', 'bootstrap_setup' );
if ( ! function_exists( 'bootstrap_setup' ) ):
function bootstrap_setup(){
add_action( 'init', 'register_menu' );
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.socket mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
maxconn 2048
@alfredochuc
alfredochuc / nginx-tuning.md
Created April 11, 2019 18:07 — 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.

@alfredochuc
alfredochuc / app-koa.js
Created April 8, 2019 21:21 — forked from Unitech/app-koa.js
Node.js Load Balancers Benchmark: HAProxy vs Nginx vs PM2
const Koa = require('koa');
const app = new Koa();
app.use(ctx => {
ctx.body = 'Hello World';
});
var listener = app.listen(process.env.PORT || 3000, () => {
console.log(`Listening on port ${listener.address().port}`);
});
@alfredochuc
alfredochuc / 0.config
Created April 5, 2019 15:19 — forked from christiannelson/0.config
Using HAProxy with Node.js, Socket.io and SSL
global
nbproc 1
maxconn 65536
defaults
timeout connect 5s
timeout queue 5s
timeout server 30s
timeout tunnel 1h
@alfredochuc
alfredochuc / MANUAL.md
Created November 28, 2018 01:02 — forked from s-lyn/MANUAL.md
Deploy nodejs app with gitlab.com and pm2

Deploy nodejs app with gitlab.com and pm2

This manual is about setting up an automatic deploy workflow using nodejs, PM2, nginx and GitLab CI. It is tested on:

  • Target server: Ubuntu 16.04 x64. This is suitable for Ubuntu 14.x.
  • Windows 10 on my PC to work.
Name: Flash
Serial: eNrzzU/OLi0odswsqnHLSSzOqDGoca7JKCkpsNLXLy8v1ytJTczVLUotKNFLzs8FAJHYETc=
if anyone wants to thank ETH: 0x527c2aB55b744D6167dc981576318af96ed26676
Thank you!