Skip to content

Instantly share code, notes, and snippets.

@zh
zh / server.js
Created April 13, 2011 08:16 — forked from sintaxi/server.js
simple reverse proxy with node.js
var http = require("http"),
util = require("util")
http.createServer(function(req, rsp){
var regex = /^\/(v1|v2)/g
var matches = req.url.match(regex)
if((matches && matches[0] === "/v1") || (req.headers["x-api-version"] === "v1"))
var port = 8001
@ck-on
ck-on / ocp.php
Last active May 18, 2024 22:35
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)#ocp #php #opcache #opcode #cache #zend #optimizerplus #optimizer+
<?php
/*
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP)
Author: _ck_ (with contributions by GK, stasilok)
Version: 0.1.7
Free for any kind of use or modification, I am not responsible for anything, please share your improvements
* revision history
0.1.7 2015-09-01 regex fix for PHP7 phpinfo
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter
@brnacl
brnacl / app.js
Last active July 27, 2023 20:03
Host multiple Node.js apps on single ubuntu server
var httpProxy = require('http-proxy');
var options = {
router: {
'example.com': '127.0.0.1:3000',
'example.com/site1': '127.0.0.1:3000'
}
};
var proxyServer = httpProxy.createServer(options);
@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
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

@fevangelou
fevangelou / my.cnf
Last active May 25, 2024 19:49
Optimized my.cnf configuration for MySQL/MariaDB (on cPanel/WHM servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on cPanel/WHM servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@Liblor
Liblor / .Xresources
Last active January 24, 2019 18:24
My .Xresources file. Color Scheme: Dark Tango
! Terminal: urxvt
! ===============
! Tango color scheme
! ------------------
URxvt*foreground: #eeeeec
URxvt*background: #2e3436
URxvt*cursorColor: #8ae234
URxvt*colorUL: #8ae234
URxvt*underlineColor: #92659a
@alirezamika
alirezamika / autoscraper-examples.md
Last active July 3, 2024 21:02
AutoScraper Examples

Grouping results and removing unwanted ones

Here we want to scrape product name, price and rating from ebay product pages:

url = 'https://www.ebay.com/itm/Sony-PlayStation-4-PS4-Pro-1TB-4K-Console-Black/203084236670' 

wanted_list = ['Sony PlayStation 4 PS4 Pro 1TB 4K Console - Black', 'US $349.99', '4.8'] 

scraper.build(url, wanted_list)
@Mosquid
Mosquid / cherry-picker-adapter-gearbest.js
Last active March 17, 2023 20:40
GearBest Cherry Picker adapter
window.cpAdapter = {
getProductTitle: function () {
try {
const [pageData] = window.dataLayer
return pageData.goods.title
} catch (err) {
console.error(err)
return ""
}
},