Skip to content

Instantly share code, notes, and snippets.

Avatar

Damian Rajca damekr

View GitHub Profile
View logrus logging filename and line
package main
import (
"fmt"
"os"
"runtime"
"strings"
"github.com/sirupsen/logrus"
)
@damekr
damekr / redirect_port_to_ip-port.sh
Last active November 3, 2017 19:46
Script to redirect port on host to diffetent ip
View redirect_port_to_ip-port.sh
#!/bin/bash
function printHelp(){
echo "This tool can be used to redirect tcp port from host on which is being run to another routable ip and port from this host"
echo
echo "USAGE:"
echo "$(basename $0) <destinationIP> <sourcePort> <destinationPort>"
}
@damekr
damekr / nova.conf
Created June 30, 2017 10:15 — forked from ksingh7/nova.conf
Failed to connect to server (code 1006) openstack VNC
View nova.conf
Problem : Unable to connect to Openstack instance console using VNC using openstack Horizon
Error Message : Failed to connect to server (code 1006)
Environnment : OpenStack RDO Juno , CentOS7
Solution: You need to update vncserver_proxyclient_address with the openstack controller IP address OR novavncproxy_base_url IP address as shown below
[root@os-node1 ~(keystone_admin)]# cat /etc/nova/nova.conf | grep -v "#" | grep -i vnc
novncproxy_host=0.0.0.0
novncproxy_port=6080
novncproxy_base_url=https://192.168.1.111:6080/vnc_auto.html
View Bash spinner
spin()
{
local \
before_msg="$1" \
after_msg="$2"
local spinner
local -a spinners
spinners=(⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏)
# hide cursor
View client.go
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@damekr
damekr / context.go
Created December 1, 2016 20:22 — forked from iamralch/context.go
An example that illustrates how to work with https://godoc.org/golang.org/x/net/context
View context.go
package main
import (
"bufio"
"fmt"
"os"
"strings"
"time"
"golang.org/x/net/context"