Skip to content

Instantly share code, notes, and snippets.

@garudareiga
garudareiga / heroku_clk_with_git.md
Last active December 20, 2015 06:18
Heroku CLI with Git

Heroku Apps

Create a Heroku app from a git repo and verify the remote in your git configuration

$ heroku create
$ git remote -v

Add an existing Heroku app to a git repo

@garudareiga
garudareiga / sqlite3_readme.md
Last active December 21, 2015 02:48
Sqlite Notes

INIT FILE

sqlite3 reads a configuration file ~/.sqliterc for the interactive command line. It generally only contain meta-commands such as

.headers ON
.mode column
.nullvalue NULL
@garudareiga
garudareiga / postgresql_readme.md
Last active December 21, 2015 02:59
Some stuff about PostgreSQL

PostgreSQL .psqlrc Tips

List of tips:

  • Show date on startup
  • Be verbose about feeback
  • Set all null fields to NULL
  • Turn off the pager so that results keep scrolling by, rather than stopping
  • Set the command history files for each host and database
  • Set the number of commands to store in the command history
@garudareiga
garudareiga / git_readme.md
Last active December 26, 2015 22:38
Store basic git commands I use daily

Git Branches

We have two types of branches: local branches and remote-tracking branches. The names of tracking branches are make up of the name of a "remote" followd by "/" and then the name of a branch in that remote repository.

$ git branch
$ git branch -r

These branches are stored locally:

  • .git/refs/heads (for local branches)
  • .git/refs/remotes/ (for remote-tracking branches)
@garudareiga
garudareiga / mongodb_readme.md
Last active January 1, 2016 21:19
Basic MongoDB commands

Connect to a Database

  • To report the name of the current database
    db
  • To display the list of databases
 show dbs
@garudareiga
garudareiga / logging.json
Created January 15, 2014 21:53
A Python logging configuration file with JSON format
{
"version": 1,
"disable_existing_loggers": false,
"formatters": {
"simple": {
"format": "%(name)s - %(levelname)s - %(message)s"
}
},
"handlers": {
@garudareiga
garudareiga / logger2.py
Created January 15, 2014 22:21
A python logging module file
import logging
logger = logging.getLogger(__name__)
def foo():
logger.debug('Dump debug message')
logger.info('Dump info message')
logger.warn('Dump warn message')
logger.error('Dump error message')
logger.critical('Dump critical message')
@garudareiga
garudareiga / logger3.py
Last active January 3, 2016 09:58
A python logging module file.
import logging
logger = logging.getLogger(__name__)
formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s')
handler_stream = logging.StreamHandler()
handler_stream.setFormatter(formatter)
logger.addHandler(handler_stream)
@garudareiga
garudareiga / logger1.py
Created January 15, 2014 22:33
A Python logging module file
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
formatter = logging.Formatter('[%(levelname)s] %(message)s')
handler_stream = logging.StreamHandler()
handler_stream.setFormatter(formatter)
handler_stream.setLevel(logging.INFO)
@garudareiga
garudareiga / logger0.py
Created January 16, 2014 07:35
A Python logging module file
import logging
def foo():
logging.debug('Dump debug message')
logging.info('Dump info message')
logging.warn('Dump warn message')
logging.error('Dump error message')
logging.critical('Dump critical message')