Skip to content

Instantly share code, notes, and snippets.

View haisum's full-sized avatar

Haisum Mussawir haisum

View GitHub Profile
@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
#############################################################################
@haisum
haisum / dropuser.sql
Created October 10, 2016 08:26
Dropping connected users in oracle
select 'alter system kill session ''' || sid || ',' || serial# || ''';' from v$session where username = 'SCHEMANAME'
alter system kill session '1977,12013';
drop user 'SCHEMANAME';
@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 "$");
@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).

@peterhellberg
peterhellberg / graceful.go
Last active August 20, 2023 08:49
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
@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!
@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

@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"
@tsabat
tsabat / zsh.md
Last active December 25, 2023 19:16
Getting oh-my-zsh to work in Ubuntu
@jackspirou
jackspirou / StringMapStringMarshalXML.go
Last active January 22, 2024 06:42
Marshal a map of strings to strings to XML in Golang.
// StringMap is a map[string]string.
type StringMap map[string]string
// StringMap marshals into XML.
func (s StringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error {
tokens := []xml.Token{start}
for key, value := range s {