Skip to content

Instantly share code, notes, and snippets.

View glebtv's full-sized avatar

Gleb glebtv

View GitHub Profile
@glebtv
glebtv / LogAfterRequest.php
Created November 25, 2021 11:47 — forked from Shelob9/LogAfterRequest.php
Log all request to Laravel app. Based on http://blog.phakeapps.com/2015/06/23/log-every-request-and-response-in-laravel-5/ updated for Laravel 5.3
namespace App\Http\Middleware;
use Illuminate\Support\Facades\Log;
class LogAfterRequest {
public function handle($request, \Closure $next)
{
return $next($request);
}
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@glebtv
glebtv / work.rb
Created December 4, 2013 15:47 — forked from rklemme/work.rb
require 'set'
LOCK = Mutex.new
num = Integer(ARGV.shift || 4)
processes = Set.new
Signal.trap "INT" do |s|
$stderr.puts "Shutdown"
require 'msgpack'
require 'thread'
class ProcessPool
def initialize(num_process, args={})
queue_size, worker_class = parse_args([
:queue_size, nil,
:worker_class, Worker,
], args)