Skip to content

Instantly share code, notes, and snippets.

View esolitos's full-sized avatar

Marlon (Esolitos) Saglia esolitos

View GitHub Profile
@lav45
lav45 / main.conf
Last active March 29, 2018 20:10
Nginx VirtualDocumentRoot
server {
listen 80;
server_name ~^((?<sub>[^\.]+)\.)?(?<domain>[^\.]+)\.my$;
charset utf-8;
client_max_body_size 128m;
index index.php index.html index.htm;
error_log /var/www/log/nginx.error.log warn;
log_not_found on;
access_log off;
@shamil
shamil / mount_qcow2.md
Last active June 11, 2024 03:56
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@nitaku
nitaku / README.md
Last active May 12, 2024 22:24
Minimal JSON HTTP server in python

A minimal HTTP server in python. It sends a JSON Hello World for GET requests, and echoes back JSON for POST requests.

python server.py 8009
Starting httpd on port 8009...
curl http://localhost:8009
{"received": "ok", "hello": "world"}
@bruceoutdoors
bruceoutdoors / DbmigrateController.php
Last active May 25, 2024 11:41
Laravel 4 Convert existing MySQL database to migrations. This is a fork of Christopher Pitt's work http://laravelsnippets.com/snippets/convert-an-existing-mysql-database-to-migrations, which is based off michaeljcalkins's work at http://paste.laravel.com/1jdw#sthash.0nEgQzQR.dpuf. His original source code doesn't really work out of the box in my…
<?php
/* * **
*
* This script converts an existing MySQL database to migrations in Laravel 4.
*
* 1. Place this file inside app/controllers/
*
* 2. In this file, edit the index() method to customize this script to your needs.
* - inside $migrate->ignore(), you pass in an array of table
@frdmn
frdmn / bash_aliases
Last active November 13, 2023 17:47
Nginx and PHP-FPM configuration + default virtual host
alias nginx.start='sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.stop='sudo launchctl unload /Library/LaunchDaemons/homebrew.mxcl.nginx.plist'
alias nginx.restart='nginx.stop && nginx.start'
alias php-fpm.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist"
alias php-fpm.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.php56.plist"
alias php-fpm.restart='php-fpm.stop && php-fpm.start'
alias mysql.start="launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.stop="launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist"
alias mysql.restart='mysql.stop && mysql.start'
alias nginx.logs.error='tail -250f /usr/local/etc/nginx/logs/error.log'
@SysADMINsLife
SysADMINsLife / gist:7319773
Created November 5, 2013 14:24
Teamspeak 3 Server Debian Startup Script
#!/bin/sh
### BEGIN INIT INFO
# Provides: teamspeak3
# Required-Start: $local_fs $network
# Required-Stop: $local_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Teamspeak 3 Server
### END INIT INFO
@danslimmon
danslimmon / logstash_postfix.conf
Last active July 30, 2018 21:32
My logstash config for postfix logs
filter {
# Capture all the generic syslog stuff and populate @timestamp
if [type] == "postfix" {
grok {
match => [ "message", "%{SYSLOGBASE} %{GREEDYDATA:_syslog_payload}" ]
singles => true
}
# Postfix pads single-digit numbers with spaces (WHYYYYY)
mutate { gsub => [ "timestamp", " ", " 0" ] }
date { match => [ "timestamp", "MMM dd HH:mm:ss"] }
@hathaway
hathaway / elasticsearch_proxy.conf
Last active December 6, 2018 12:22
nginx proxy for elasticsearch
server {
listen 8080;
server_name elasticsearch;
client_max_body_size 50M;
error_log /var/log/nginx/elasticsearch-errors.log;
access_log /var/log/nginx/elasticsearch.log;
location / {
@akuznecov
akuznecov / memcached
Created July 3, 2013 13:07
Multiple memcached instances with single init-script on Debian-like systems
#! /bin/sh
### BEGIN INIT INFO
# Provides: memcached
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: memcached - Memory caching daemon
@akuznecov
akuznecov / varnish.php
Created June 25, 2013 05:40
GeSHi syntax file for Varnish configuration language (VCL)
<?php
/*************************************************************************************
* varnish.php
* ------
* Author: Alexander Kuznetcov (alexander@kuznetcov.me)
* Copyright: (c) Alexander Kuznetcov (http://blog.tenya.me)
* Release Version: 1.0.0.0
* Date Started: 2013/06/25
*
* Varnish 3.x language file for GeSHi.