Skip to content

Instantly share code, notes, and snippets.

View hbasria's full-sized avatar

Basri hbasria

View GitHub Profile
#!/bin/bash
NAME="hello_app" # Name of the application
DJANGODIR=/webapps/hello_django/hello # Django project directory
SOCKFILE=/webapps/hello_django/run/gunicorn.sock # we will communicte using this unix socket
USER=hello # the user to run as
GROUP=webapps # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=hello.settings # which settings file should Django use
DJANGO_WSGI_MODULE=hello.wsgi # WSGI module name
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static

installing postgresql 9.3.2 on ubuntu 12.04

$ echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install postgresql-9.3 postgresql-contrib-9.3

you should succesfully installing postgresql 9.3.2 on your machine.

# /etc/elasticsearch/elasticsearch.yml
#
# Remember the cluster name if you ever add extra nodes
cluster.name: logstash
# If you leave node.name blank, it'll autogenerate a node name each time you start ES, picking from 3000 marvel comicbook heroes.
node.name: "log-indexer"
node.master: true
node.data: true
# Set the bind address specifically (IPv4 or IPv6)
#!/bin/sh
### BEGIN INIT INFO
# Provides: gunicorn
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the gunicorn server
# Description: starts gunicorn using start-stop-daemon
{
"template": "logstash-*",
"settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"index" : {
"query" : { "default_field" : "@message" },
"store" : { "compress" : { "stored" : true, "tv": true } }
}
},
@hbasria
hbasria / graphite.md
Last active August 29, 2015 14:07 — forked from kgadek/graphite.md

Installing Graphite:

Graphite does two things:

  1. Store numeric time-series data
  2. Render graphs of this data on demand

What Graphite does not do is collect data for you, however there are some tools out there that know

WITH weeks AS (
SELECT distinct date_trunc('week', dates)::date AS start,
daterange(date_trunc('week', dates)::date, (date_trunc('week', dates) + interval '7 days')::date) week
FROM generate_series(date '2013-01-01', now(), '1 day')
dates ORDER BY 1
)
SELECT weeks.start,
count(whatever.*) as count
FROM whatever
JOIN weeks
#result = dict_items(response, 'Body/findResponse/result/Interface')
def dict_items(dict, path, separator='/'):
for item in path.split(separator):
if item in dict:
dict = dict[item]
if type(dict) is str and len(dict)<=0:
return None
else:
--select deps_save_and_drop_dependencies('public','test_table')
--select deps_restore_dependencies('public','test_table')
--select * from deps_saved_ddl
create table deps_saved_ddl
(
deps_id serial primary key,
deps_view_schema varchar(255),