Skip to content

Instantly share code, notes, and snippets.

View kgrvamsi's full-sized avatar
🎯
Focusing

Vamsi Kotipalli kgrvamsi

🎯
Focusing
  • Amazon (AWS)
  • Austin,TX
View GitHub Profile
@kgrvamsi
kgrvamsi / .tmux.conf
Last active August 29, 2015 14:17 — forked from naoya/.tmux.conf
# $Id: screen-keys.conf,v 1.7 2010-07-31 11:39:13 nicm Exp $
#
# By Nicholas Marriott. Public domain.
#
# This configuration file binds many of the common GNU screen key bindings to
# appropriate tmux key bindings. Note that for some key bindings there is no
# tmux analogue and also that this set omits binding some commands available in
# tmux but not in screen.
#
# Note this is only a selection of key bindings and they are in addition to the
func readLine(path string) {
inFile, _ := os.Open(path)
defer inFile.Close()
scanner := bufio.NewScanner(inFile)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
fmt.Println(scanner.Text())
}
}

Types

type Vertex struct {
    Lat, Long float64
}

Maps

@kgrvamsi
kgrvamsi / cpus.sh
Last active August 29, 2015 14:25 — forked from jj1bdx/cpus.sh
Number of CPUs with getconf(1)
#!/bin/sh
# Originally from:
# https://github.com/blankpage/e5UNIXBuilder/blob/master/build-akili.sh
# Linux and similar...
CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
# FreeBSD and similar...
[ -z "$CPUS" ] && CPUS=`getconf NPROCESSORS_ONLN`
# Solaris and similar...
[ -z "$CPUS" ] && CPUS=`ksh93 -c 'getconf NPROCESSORS_ONLN'`
@kgrvamsi
kgrvamsi / coreinfo
Last active August 29, 2015 14:25 — forked from stedolan/coreinfo
Prints number of cores, CPU topology and cache topology/size on Linux machines
#!/bin/bash
unshared () {
grep '^[0-9]\+$' "$1" > /dev/null
}
for cpu in $(ls -d /sys/devices/system/cpu/cpu[0-9]* | sort -t u -k 3 -n); do
echo "${cpu##*/}: [Package #$(cat $cpu/topology/physical_package_id), Core #$(cat $cpu/topology/core_id)]"
if ! unshared $cpu/topology/core_siblings_list; then
echo " same package as $(cat $cpu/topology/core_siblings_list)"
@kgrvamsi
kgrvamsi / go_scp.go
Last active August 29, 2015 14:27 — forked from jedy/go_scp.go
an example of scp in golang
// https://blogs.oracle.com/janp/entry/how_the_scp_protocol_works
package main
import (
"fmt"
"golang.org/x/crypto/ssh"
)
const privateKey = `content of id_rsa`
@kgrvamsi
kgrvamsi / testmssql.go
Created July 7, 2016 15:38 — forked from starchou/testmssql.go
the demo of github.com/denisenkom/go-mssqldb
package main
import (
"database/sql"
"fmt"
_ "github.com/denisenkom/go-mssqldb"
)
func main() {
DB, err := sql.Open("mssql", "server=172.16.32.1**;port=1433;user id=sa;password=*****;database=demo;")
@kgrvamsi
kgrvamsi / emacs-cheatsheet.md
Created October 8, 2016 05:00 — forked from scottjbarr/emacs-cheatsheet.md
Emacs Cheatsheet

Emacs Cheatsheet

C : Control key

M : Meta key

General

C-g - Exit command

@kgrvamsi
kgrvamsi / openresty-ubuntu-install.sh
Created October 24, 2016 20:25 — forked from alex-roman/openresty-ubuntu-install.sh
Easy install openresty (used and tested on Ubuntu 14.04, 15.10 and 16.04)
#!/bin/bash
apt-get -y update
apt-get -y install nginx-extras build-essential libpcre3-dev libssl-dev libgeoip-dev libpq-dev libxslt1-dev libgd2-xpm-dev
wget -c https://openresty.org/download/openresty-1.9.15.1.tar.gz
tar zxvf openresty-1.9.15.1.tar.gz
cd openresty-1.9.15.1
./configure \
--sbin-path=/usr/sbin/nginx \
--conf-path=/etc/nginx/nginx.conf \
@kgrvamsi
kgrvamsi / postgres-cheatsheet.md
Created November 10, 2016 07:04 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

If run with -E flag, it will describe the underlaying queries of the \ commands (cool for learning!).

Most \d commands support additional param of __schema__.name__ and accept wildcards like *.*