Skip to content

Instantly share code, notes, and snippets.

@zetas
zetas / default.json
Created June 13, 2018 06:00
iTerm2 Byobu Keybind Profile.
{
"Ansi 5 Color" : {
"Green Component" : 0.4117647111415863,
"Blue Component" : 0.78823530673980713,
"Red Component" : 0.55686277151107788
},
"Working Directory" : "\/Users\/david",
"Prompt Before Closing 2" : 0,
"Selected Text Color" : {
"Green Component" : 0.729411780834198,
@zetas
zetas / expanded-default.conf
Created August 29, 2017 02:06
NGINX SSL Termination Config
# configuration file /etc/nginx/nginx.conf:
# Configuration File - Nginx Server Configs
# http://nginx.org/en/docs/dirindex.html
# Run as a unique, less privileged user for security reasons.
# Default: nobody nobody
user www-data www-data;
# Sets the worker threads to the number of CPU cores available in the system for best performance.
# Should be > the number of CPU cores.
@zetas
zetas / webhook.php
Created July 30, 2017 06:14
output variables to a logfile
<?php
$log = fopen('/tmp/webhook.log', 'a+');
ob_start();
var_dump($_SERVER);
$content = ob_get_clean();
fwrite($log, $content);
fclose($log);
@zetas
zetas / Blockchain.php
Created July 7, 2017 09:36
Super simple blockchain api wrapper
<?php
namespace nzedb\frontend\donation\Blockchain;
/**
* Super simple Blockchain.info V2 Receive API implementation.
*
* Also some usecase-specific conversion methods.
* @package nzedb\frontend\donation\Blockchain
*/
class Blockchain
location /sabnzbd {
client_max_body_size 10m;
client_body_buffer_size 128k;
#Timeout if the real server is dead
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;
# Advanced Proxy Config
send_timeout 5m;
proxy_read_timeout 240;
<?php
protected static function _filters($model, $behavior)
{
Filters::apply($model, 'save', function ($params, $next) use ($behavior) {
foreach ($behavior->config('fields') as $field) {
$params['data'][$field] = static::_btcToSatoshi($behavior, $params['entity'], $field);
}
return $next($params);
<?php
namespace app\extensions\data\behavior;
use nzedb\Users;
use lithium\aop\Filters;
class Vip extends \li3_behaviors\data\model\Behavior
{
@zetas
zetas / backup_db_incremental.php
Last active March 8, 2022 19:50
Incremental DB Backup Scripts
<?php
/**
* Incremental DB Backup Script.
*
* Requires: innobackupex percona script.
*
* Meant to run via cron, every 8 hours. It assumes during the fourth
* invocation a day has gone by.
*
* @author Kingcat <kingcat@nzb.cat>
@zetas
zetas / ceilometer.conf
Created May 19, 2015 03:00
Icehouse Ceilometer config
###################
# Existing
###################
connection = mongodb://{{ db_mongo_servers }}/{{ db_name }}?readPreference=primaryPreferred&replicaSet={{ db_replset }}
mongodb_replica_set = {{ db_replset }}
connection = mongodb://{{ db_host }}:{{ db_port }}/{{ db_name }}
##################
@zetas
zetas / ceilometer.conf
Created May 19, 2015 02:57
Havana Ceilometer Config
################
# Existing
################
connection = mongodb://{{ db_host }}:{{ db_port }}/{{ db_name }}
################
# Proposed
################