Skip to content

Instantly share code, notes, and snippets.

@Haititi
Haititi / nginx.conf
Created April 23, 2020 23:08 — forked from leandromoreira/nginx.conf
nginx.conf optmized for http/2 = HTTPS TLS (ssl)
# command to generate dhparams.pen
# openssl dhparam -out /etc/nginx/conf.d/dhparams.pem 2048
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=5r/s;
limit_req_status 444;
limit_conn_status 503;
proxy_cache_path /var/lib/nginx/proxy levels=1:2 keys_zone=backcache:8m max_size=50m;
proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";
@Haititi
Haititi / stdin_stream.hpp
Created January 22, 2019 22:12 — forked from kikairoya/stdin_stream.hpp
boost::asio AsyncReadStream for console input
class stdin_stream: boost::noncopyable {
typedef boost::function<void (const boost::system::error_code &, size_t bytes_transferred)> read_handler_type;
public:
stdin_stream(boost::asio::io_service &io, HANDLE hin): io(io), hin(hin), hev(CreateEvent(0, 0, 0, 0)), handler(), buffer(0), size(0) {
_beginthread(&stdin_stream::thread_handler_gateway, 0, this);
}
~stdin_stream() {
buffer = 0;
CloseHandle(hev);
}
<?php
AppEventDispatcher::listen(function(CakeEvent $event) {
$myModel = ClassRegistry::init('MyUserPlugin.User');
return $myModel->onArticleBeforeSaveCallback($event);
}, 'Model.Article.beforeSave');
?>
@Haititi
Haititi / munin-fastcgi
Created April 14, 2014 16:13
Startup script for Munin CGI services
#! /bin/sh
### BEGIN INIT INFO
# Provides: munin-fastcgi
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Should-Start: munin
# Should-Stop: munin
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Startup script for Munin CGI services
@Haititi
Haititi / rules-both.iptables
Last active August 29, 2015 13:58
Basic iptables template for ordinary servers (both IPv4 and IPv6)
###############################################################################
# The MIT License
#
# Copyright 2012-2014 Jakub Jirutka <[email protected]>.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is