Skip to content

Instantly share code, notes, and snippets.

@banterweb
banterweb / replicate_remote_database.py
Created August 7, 2016 04:41 — forked from CodyKochmann/replicate_remote_database.py
create a replication link in couchdb with python
def replicate_remote_database(username,password,target_ip,db_name):
import couchdb
server = couchdb.Server() # connects to the local_server
server.replicate(
'http://{}:{}@{}:5984/{}'.format(
username,
password,
target_ip,
db_name
),
@banterweb
banterweb / get_ip.py
Created August 7, 2016 04:40 — forked from CodyKochmann/get_ip.py
get ip address in python
def get_ip():
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("gmail.com",80))
out=(s.getsockname()[0])
s.close()
return out

Pipe a remote machine's localhost:5432 for postgres to your localhost:6432

    ssh -nNT -L 9000:localhost:5432 user@database-ip-address

You can then use psql -h localhost -p 6432 to connect to the database locally.


@banterweb
banterweb / gist:ac8caa5291e5ef974192262aab74b869
Created August 7, 2016 04:39 — forked from cracell/gist:1284914
Platform Interface Pattern/Idea

Perfect World of Web Development

About This

This writeup is about where I see web development going, where I want it to go and where I think it should go but it shouldn't.

About Me (To understand my perspective)

Platform Interface Pattern

Don't lock things in. But give an obvious path for beginners. Locking things makes evolution to better tools more difficult. Giving options makes getting this done more difficult and time consuming.

@banterweb
banterweb / Docker-Cheat-Sheet.md
Created August 7, 2016 04:38 — forked from rafaelune/Docker-Cheat-Sheet.md
Docker cheat sheet

'docker ps' -> Lists containers.

'docker ps -a' -> Lists all containers.

'docker logs' -> Shows us the standard output of a container.

'docker stop' -> Stops running containers.

'docker rm ' -> Removes a container.

@banterweb
banterweb / git-workflow.md
Created August 7, 2016 04:35 — forked from forest/git-workflow.md
Git Feature Branch Workflow

We subscribe to the Git Featrue Branch workflow, briefly described in that link.

In practice, it works as follows:

FEATURE DEVELOPMENT

Steps to Follow:

  1. Start with an updated local development branch -- by checking out the dev branch and pulling changes:
    git checkout development
    git pull origin development
@banterweb
banterweb / MongoDB Cheats
Created August 7, 2016 04:34 — forked from mallond/MongoDB Cheats
MongoDB Cheats
Various Cheats found on the Web
mongo //Start Mongo
show dbs //Show databases
use mydb //User database named "­myd­b"
db //Show selected database
help //Get help
show collec­tion //Show collec­tions from a database
Finds - db.collection

What is ElasticSearch ?

  • Its a nosql distributed full text database
  • This database is documents based
  • Build on Lucene engine and HTTP top of it
  • Its Open Source, Scalable and Fast

Why should I use it ?

  • Speed: Index millions of documents.
  • Relevancy & Score: Select post from blog where post like '%foo%';
  • Statistics: Spot trends in your data
@banterweb
banterweb / git cheat
Created August 7, 2016 04:33 — forked from forest/git cheat
Git Cheat. #git #cheat
# create a branch
git branch <branch>
# delete a branch
git branch -d|D <branch>
# go back to master
git checkout master
# merge branch to master
@banterweb
banterweb / cheat_sheet.md
Created August 7, 2016 04:31 — forked from cmugla/cheat_sheet.md
Cheat Sheet

Introduction to the Internet

By definition the Internet is a worldwide, publicly accessible series of interconnected computer networks that transmit data by packet switching using the standard Internet Protocol

  • Server Responses
    • 100: Informational
      • 100: Continue - Server receives request headers and client should proceed to send body