Skip to content

Instantly share code, notes, and snippets.

@nimolix
nimolix / extra.conf
Created May 15, 2019 13:00
Disallow access to .bzr, .git, .hg, .svn, .cvs directories: return 404 as not to disclose information.
location ^~ /.(bzr|git|hg|svn|cvs) {
return 404;
}
location ^~ /node_modules {
return 404;
}
location ^~ /Gruntfile.js {
return 404;
<?php
$directories = ['application', 'library', 'database', ''];
define("CWD", dirname(__FILE__));
echo '<h1>Parallel PHP Linter</h1>';
$time_start = microtime(true);
@nimolix
nimolix / .psqlrc
Created August 3, 2014 06:47
My .psqlrc
-- \set PROMPT1 '%n@%m %/%R%x%# '
-- \set PROMPT2 '%n@%m %/%R%x%# '
\set PROMPT1 '%M:%[%033[1;31m%]%>%[%033[0m%] %n@%[%033[1;32m%]%/%[%033[0m%]%R%#%x '
\set PROMPT2 '%M %n@%[%033[1;32m%]%/%[%033[0m%]%R %# '
-- \set AUTOCOMMIT off
\pset null '[null]'
\set COMP_KEYWORD_CASE upper
\set ON_ERROR_ROLLBACK interactive
-- \set VERBOSITY verbose
\set version 'SELECT version();'
@nimolix
nimolix / ssl.go
Created February 21, 2014 05:13
Two-way SSL
package main
import(
"crypto/rand"
"crypto/tls"
"io/ioutil"
"log"
"net"
"net/http"
"compress/gzip"
@nimolix
nimolix / reverse_proxy.go
Last active January 2, 2016 11:19
Reverse proxy in Go in 200 lines of code
package main
// (c) http://habrahabr.ru/users/pyra/ BSD license
import (
// "encoding/json"
"fmt"
// "io"
"io/ioutil"
"log"
"time"
package main
type Task struct {
action func()
depends_on []*Task
}
func (t *Task) Run() {
if t.depends_on != nil {
@nimolix
nimolix / domains.txt
Created April 2, 2013 08:07
Parallel DNS lookup comparison between Ruby and Go
aol.com
anonymous.to
comcast.net
dispostable.com
everymail.net
everyone.net
flashmail.com
gmail.com
googlemail.com
guerillamail.com
@nimolix
nimolix / gist:4382065
Created December 26, 2012 18:30
Convert a numeric value into Persian words
String.prototype.persianThousandsSeparator = function () {
var val = this.toString();
var x = val.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + '٬' + '$2');
}
return x1 + x2;