Skip to content

Instantly share code, notes, and snippets.

View necromant2005's full-sized avatar

Rostyslav Mykhajliw necromant2005

View GitHub Profile
<?php
$landing = '/';
$goal = '/metric?signup';
$retention = '/metric?signin';
$dir = __DIR__ . '/nginx';
$full = __DIR__ . '/full.log';
unlink($full);
for($i=0;$i<100;$i++) {
@necromant2005
necromant2005 / extract.php
Last active December 15, 2015 15:39
extract *.gz files and remove error logs for the next step
<?php
$dir = __DIR__ . "/nginx";
foreach (new DirectoryIterator($dir) as $item) {
if (!$item->isFile()) continue;
if (strpos($item, 'access')===false) {
unlink($item->getPathname());
continue;
}
if (!strpos($item, '.gz')) continue;
system('gunzip ' . escapeshellarg($item->getPathname()));
@necromant2005
necromant2005 / bind-consul.sh
Created October 12, 2015 08:31 — forked from wfaler/bind-consul.sh
use consul as DNS for local services, fronted by Bind for the rest
sudo apt-get install bind9 bind9utils bind9-doc
wget https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip
/etc/bind/named.conf.options:
options {
directory "/var/cache/bind";
recursion yes;
allow-query { localhost; };
forwarders {
@necromant2005
necromant2005 / consul.service
Last active October 12, 2015 08:01 — forked from yunano/consul.service
/etc/systemd/system/consul.service
[Unit]
Description=consul agent
Requires=network-online.target
After=network-online.target
[Service]
EnvironmentFile=-/etc/sysconfig/consul
Environment=GOMAXPROCS=2
Restart=on-failure
ExecStart=/usr/local/sbin/consul agent $OPTIONS -config-dir=/etc/consul.d
@necromant2005
necromant2005 / MyApp.conf
Created November 1, 2012 08:44
Nginx.conf
server {
server_name myhost.com www.myhost.com;
root /var/www/MyAppName/public;
index index.php;
location / {
if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}
@necromant2005
necromant2005 / deploy.rb
Created November 1, 2012 08:39
recipy php
ssh_options[:keys] = [File.join(Dir.pwd, "config", "ubuntu.pem")]
set :application, "MyAPPNAME"
set :repository, "git@github.com:necromant2005/MYAPPName.git"
# If you aren't deploying to /u/apps/#{application} on the target
# servers (which is the default), you can specify the actual location
# via the :deploy_to variable:
set :deploy_to, "/var/www/#{application}"