Skip to content

Instantly share code, notes, and snippets.

View haisum's full-sized avatar

Haisum Mussawir haisum

View GitHub Profile
@ismasan
ismasan / purge.vcl
Created January 27, 2011 18:30
Varnish VCL example for purging wildcard URLs
# This goes in vcl_recv
# It gives you:
# curl -X PURGE http://some.example.com/.*
# curl -X PURGE http://some.example.com/blog/.*
# curl -X PURGE http://some.example.com/blog/2011/bar.html
# curl -X PURGE http://another.example.com/.*
#
if (req.request == "PURGE") {
# Wildcard, per-domain purging
purge("req.http.host == " req.http.host " && req.url ~ " req.url "$");
@dalecaru
dalecaru / innobackupex-restore.sh
Created April 20, 2011 13:42
Scripts to create and restore full and incremental backups (for all databases on server) using innobackupex from Percona.
#!/bin/sh
#
# Script to prepare and restore full and incremental backups created with innobackupex-runner.
#
# This script is provided as-is; no liability can be accepted for use.
#
INNOBACKUPEX=innobackupex-1.5.1
INNOBACKUPEXFULL=/usr/bin/$INNOBACKUPEX
TMPFILE="/tmp/innobackupex-restore.$$.tmp"
@dougmorato
dougmorato / sphinx.conf
Created June 20, 2011 16:30
Sample sphinx.conf file to index Tryton product name and description
#
# Sphinx configuration file sample
#
# Please refer to doc/sphinx.html for details.
#
#############################################################################
## data source definition
#############################################################################
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@irazasyed
irazasyed / How-To Install Memcache on CentOS WHM-cPanel.md
Last active November 15, 2023 14:28
How-To: Install Memcache on CentOS (WHM/cPanel)

How-To: Install Memcache on CentOS (WHM/cPanel)

Without wasting much time, Let us get started!

Follow these simple instructions:

  • Step 1: Login into your WHM panel and using easyapache enable Memcache

  • Step 2: SSH into your server and fire this command yum install memcached.x86_64 php-pecl-memcache.x86_64

@magnetikonline
magnetikonline / README.md
Last active December 22, 2021 17:13
Using Dnsmasq with Ubuntu 16.04LTS/14.04LTS/12.04LTS for virtual machine web application testing.

Using Dnsmasq with Ubuntu for VM web application testing

When running virtual machines under a Linux host system for testing web apps in various browsers (e.g. Internet Explorer), I found it rather tedious having to continually tweak the hosts file within each VM for the purpose of adding entries pointing back to the host machine's development web server address.

Instead the steps below will setup Dnsmasq on a Ubuntu 16.04LTS, 14.04LTS or 12.04LTS host machine for the purpose of serving both it's own DNS queries and that of virtual machine guests. Dnsmasq will parse the /etc/hosts file on your host machine where we will keep a single set of DNS entires to our test web application(s).

@dmitshur
dmitshur / gist:6927554
Last active September 17, 2023 07:35
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.

$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
	insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out server.pem -days 365 -nodes
# run as follows:
# python simple-https-server.py
# then in your browser, visit:
# https://localhost:4443
import BaseHTTPServer, SimpleHTTPServer
import ssl
@tott
tott / ip_in_range.php
Created November 27, 2013 22:46
php check if IP is in given network range
/**
* Check if a given ip is in a network
* @param string $ip IP to check in IPV4 format eg. 127.0.0.1
* @param string $range IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
* @return boolean true if the ip is in this range / false if not.
*/
function ip_in_range( $ip, $range ) {
if ( strpos( $range, '/' ) == false ) {
$range .= '/32';
}