Skip to content

Instantly share code, notes, and snippets.

@zetas
zetas / default.json
Created Jun 13, 2018
iTerm2 Byobu Keybind Profile.
View default.json
{
"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 Aug 29, 2017
NGINX SSL Termination Config
View expanded-default.conf
# 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 Jul 30, 2017
output variables to a logfile
View webhook.php
<?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 Jul 7, 2017
Super simple blockchain api wrapper
View Blockchain.php
<?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
View gist:72b2aa408768efd4de04000d2ab27a9c
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;
View example.php
<?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);
View Vip.php
<?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 Mar 8, 2022
Incremental DB Backup Scripts
View backup_db_incremental.php
<?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
Icehouse Ceilometer config
View ceilometer.conf
###################
# 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
Havana Ceilometer Config
View ceilometer.conf
################
# Existing
################
connection = mongodb://{{ db_host }}:{{ db_port }}/{{ db_name }}
################
# Proposed
################