Skip to content

Instantly share code, notes, and snippets.

View dhanush's full-sized avatar

Dhanush Gopinath dhanush

View GitHub Profile
@dhanush
dhanush / apache-conf
Last active December 24, 2015 09:13
The config file of Apache server which has Wordpress installed
<VirtualHost *:7000>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ServerName geektrust.in
<Directory /var/www/html/blog>
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
@dhanush
dhanush / nginx-conf
Last active August 9, 2016 19:09
NGINX configuration for having a nodejs server and wordpress behind an Nginx reverse proxy
upstream backend {
server <IP1>:<PORT>;
server <IP2>:<PORT>;
}
server {
listen 80;
server_name geektrust.in;
return 301 https://www.geektrust.in$request_uri;
}
@dhanush
dhanush / add.js
Last active December 29, 2015 11:37
var add = function (a,b) {
console.log(this.value)
return a+b
};
var sum = add(5,6)
console.log(sum)
var add = function(a,b){
console.log(this.value)
return a+b;
};
var methodInvoc = {
value : 0,
myadd : add //reference to global add method
}
package main
import (
"bytes"
"fmt"
"html/template"
"net/smtp"
)
var auth smtp.Auth
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
</head>
<body>
<p>
Hello {{.Name}}
<a href="{{.URL}}">Confirm email address</a>
reader, _ := cli.ContainerLogs(context.Background(), containerID, types.ContainerLogsOptions{
ShowStdout: true,
Follow: true,
})
defer reader.Close()
content, _ := ioutil.ReadAll(reader)
fmt.Println(string(content))
@dhanush
dhanush / container_read_with_skip.go
Last active August 10, 2017 07:25
container_read_with_skip.go
reader, _ := cli.ContainerLogs(context.Background(), containerID, types.ContainerLogsOptions{
ShowStdout: true,
Follow: true,
})
defer reader.Close()
//read the first 8 bytes to ignore the HEADER part from docker container logs
p := make([]byte, 8)
reader.Read(p)
content, _ := ioutil.ReadAll(reader)
@dhanush
dhanush / user_preferences.json
Last active October 4, 2020 10:45
This is the user preferences json for the Geektrust Cloud Architecture Coding Challenge
[
{
"100": {
"preferred_languages": [
"English",
"Spanish"
],
"favourite_actors": [
"Denzel Washington",
"Kate Winslet",
"Summer is coming",
"a1d22n333a4444p",
"oaaawaala",
"zmzmzmzaztzozh",
"Go, risk it all",
"Let's swing the sword together",
"Die or play the tame of thrones",
"Ahoy! Fight for me with men and money",
"Drag on Martin!",
"When you play the tame of thrones, you win or you die.",