Skip to content

Instantly share code, notes, and snippets.

View paulocoghi's full-sized avatar
🎯
Focusing

Paulo Coghi paulocoghi

🎯
Focusing
View GitHub Profile
@tomazzaman
tomazzaman / hhvm.conf
Last active September 22, 2016 08:23
Restart HHVM with Monit
# This file should be in /etc/monit/conf.d
check process hhvm with pidfile /var/run/hhvm/pid
group hhvm
# Start program calls our custom script from above
start program = "/usr/local/sbin/start_hhvm.sh"
stop program = "/usr/sbin/service hhvm stop"
if failed unixsocket /var/run/hhvm/hhvm.sock then restart
if mem > 400.0 MB for 1 cycles then restart
if 5 restarts with 5 cycles then timeout
@pelmered
pelmered / wpfcwc.conf
Created March 27, 2015 08:56
EasyEngine WooCommerce config with FastCGI Cache
#
set $skip_cache 0;
# POST requests and URL with a query string should always go to php
if ($request_method = POST) {
set $skip_cache 1;
}
if ($query_string != "") {
@maop
maop / soyoustart.py
Created December 10, 2015 02:11
Python Script for watching SoYouStart.com server availability, it can watch many servers at many datacenters and notify by email
#!/usr/bin/env python
# I was in a hurry for a SYS server so i make this quick script,
# notice that you have to use codes from the "us" version, since server's id
# are different in the Europe versions of ovh sites
# You'll receive notification mails like this:
#
# 141cabk1 | BK-8T: Intel i3 2130 2c/4t 3.4 GHz+ 8 GB 2x4 TB SATA
# AVAILABLE (1H-low) in gra
# AVAILABLE (1H-low) in sbg
@Richzendy
Richzendy / check-availability.php
Last active May 6, 2019 09:08
Script to check SoYouStart availability
<?php
/*
* Script to check SoYouStart availability based on http://www.tienle.com/2014/09-03/script-check-soyoustart-availability.html
* to help see http://www.richzendy.org/2014/10/05/script-php-para-chequear-y-notificar-disponibilidad-de-servidores-en-soyoustart.html
*/
define('CHECK_URL', 'http://ws.ovh.com/dedicated/r2/ws.dispatcher/getAvailability2');
define('NOTIFICATION_EMAILS', 'YOUR_EMAIL@DOMAIN.COM');
define('SYSTEM_EMAIL', '1'); // 1 = enabled local smtp system
define('MANDRILL', '0'); // 1 = enable email trought mandrill api, require an account on https://mandrillapp.com/
@BrianGilbert
BrianGilbert / nginx_ojs_include.conf
Last active January 8, 2021 07:04
nginx configuration for OJS on an aegir box
#######################################################
### nginx compact ojs configuration start
#######################################################
location ~ /\.ht {
deny all;
}
location ~ ^/cache(.*)$ {
deny all;
@tschifftner
tschifftner / fail2ban-cleanup.sh
Last active March 30, 2021 15:59
Clean fail2ban database from older entry - use script with cronjob!
#!/usr/bin/env bash
# Tobias Schifftner, @tschiffnter
#
# Usage:
# bash fail2ban-cleanup.php <fail2ban.sqlite3>
FILE=${1:-"/var/lib/fail2ban/fail2ban.sqlite3"}
[ -f "$FILE" ] || { echo "$FILE not found"; exit 1; }
@mitchellkrogza
mitchellkrogza / fail2ban-reset-log-db.sh
Last active June 25, 2022 13:36
Bash script to reset Fail2Ban - clears / truncates log file and deletes the sqlite database - stops and restarts service during this process.
#!/bin/bash
# Bash Script by https://gist.github.com/mitchellkrogza
# ************************************************************
# This script clears the log file and database of Fail2Ban
# This resets Fail2Ban to a completely clean state
# Useful to use after you have finished testing all your jails
# and completed your initial setup of Fail2Ban and are now
# putting the server into LIVE mode
# ************************************************************
@eddieantonio
eddieantonio / example.py
Created March 30, 2017 20:43
Zero-dependency Python 3 and Node IPC using UNIX sockets
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
import socket
import json
server_address = '/tmp/example.sock'
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
sock.connect(server_address)
@miguelmota
miguelmota / events.js
Created June 21, 2017 04:23
JavaScript class extend EventEmitter
const EventEmitter = require('events')
class MyClass extends EventEmitter {
constructor() {
super() // required
this.emit('event', 100)
}
}
@bradwright
bradwright / websockets-server.js
Created June 11, 2011 23:29
Pure Node.js WebSockets server
/*
* node-ws - pure Javascript WebSockets server
* Copyright Bradley Wright <brad@intranation.com>
*/
// Use strict compilation rules - we're not animals
'use strict';
var net = require('net'),
crypto = require('crypto');