Skip to content

Instantly share code, notes, and snippets.

View hbasria's full-sized avatar

Basri hbasria

  • base9.tech
  • ///soak.massing.glory
View GitHub Profile

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
--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),
@hbasria
hbasria / knife cheat
Last active August 29, 2015 14:27 — forked from ipedrazas/knife cheat
Hello!
# knife cheat
## Search Examples
knife search "name:ip*"
knife search "platform:ubuntu*"
knife search "platform:*" -a macaddress
knife search "platform:ubuntu*" -a uptime
knife search "platform:ubuntu*" -a virtualization.system
knife search "platform:ubuntu*" -a network.default_gateway
@hbasria
hbasria / gist:f8e21c3bda47bd00d339
Created November 18, 2015 16:05 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
#!/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