Skip to content

Instantly share code, notes, and snippets.

View keybase.md

I hereby claim:

  • I am denishpatel on github.
  • I am denishpatel (https://keybase.io/denishpatel) on keybase.
  • I have a public key whose fingerprint is 59B3 3ECB F4EB B266 7436 7A0F 3E8D 1F9C 102B A0D8

To claim this, I am signing this object:

{
View gist:5df598bd5b9e5b3b35fa
[pgtraining@localhost ~]$ cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Thu Dec 12 01:03:55 2013
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/VolGroup-lv_root / ext4 defaults 1 1
View gist:7478115
name | version | installed | superuser | relocatable | schema | requires | comment
------------------------+---------+-----------+-----------+-------------+------------+-------------------------+---------------------------------------------------------------------
btree_gin | 1.0 | f | t | t | | | support for indexing common datatypes in GIN
dblink | 1.1 | f | t | t | | | connect to other PostgreSQL databases from within a database
unaccent | 1.0 | f | t | t | | | text search dictionary that removes accents
intarray | 1.0 | f | t | t | | | functions, operators, and index support for 1-D arrays of integers
View gist:331ac332c31429f8fe9d7152a0b07302
<script>/* Chameleon - better user onboarding */!function(t,n,o){var a="chmln",c="setup identify alias track set show on off custom help _data".split(" ");n[a]||(n[a]={}),n[a].accountToken=o,n[a].location=n.location.href.toString();for(var e=0;e<c.length;e++)!function(){var t=n[a][c[e]+"_a"]=[];n[a][c[e]]=function(){t.push(arguments)}}();var s=t.createElement("script");s.src="https://fast.trychameleon.com/messo/"+o+"/messo.min.js",s.async=!0,t.head.appendChild(s)}(document,window,"SAtlPjYMWGA1jiV7AYF1D38gSa7SE9xEoRdJwPkr58eIyh-1C3H6Z-ztbpXMzr0tGiPmve");
chmln.identify({uid: user.id /* A stable, unique identifier */, email: user.email, created: user.created_at /* Timestamp when the user was added to your system */})
</script>
proposed:
{% if current_membership != None %}
!function(t,n,o){var a="chmln",c="setup identify alias track set show on off custom help _data".split(" ");n[a]||(n[a]={}),n[a].accountToken=o,n[a].location=n.location.href.toString();for(var e=0;e<c.length;e++)!function(){var t=n[a][
@denishpatel
denishpatel / azure_postgresql_deploy.sh
Created Oct 8, 2018 — forked from robconery/azure_postgresql_deploy.sh
Deployment script for Azure PostgreSQL
View azure_postgresql_deploy.sh
#!/bin/bash
#These are the settings for deployment. The only thing you need to be sure you change is
#the resource group, as that will be the name you will use to destroy things later
USER=admin_$RANDOM #set this to whatever you like but it's not something that should be easy
PASS=$(uuidgen) #Again - whatever you like but keep it safe! Better to make it random
LOCATION=westus
SERVERNAME=northwind-$RANDOM #this has to be unique across azure
#resource group
View identity_column.md

How do you create serial column?

postgres=# create table serial_test(id serial primary key,name text);
CREATE TABLE
postgres=# \d serial_test
                            Table "public.serial_test"
 Column |  Type   | Collation | Nullable |                 Default
--------+---------+-----------+----------+-----------------------------------------
 id     | integer |           | not null | nextval('serial_test_id_seq'::regclass)
View gist:b1ead051108c56873590cccd3f7e6a48
Postgres/Postgis
Distance is an alias attribute.
Models: Business, Bookings
a business has_many bookings
business.types are 'Brick & mortar', 'food trucks'
food trucks can move to different locations throughout the day called a booking
EX: Sams Food Truck (2pm)
Date: Today
morning booking
View gist:89f8d8a48fe418fc16c36ea9b81168a5
postgres=# select * from identity_always;
id | name
----+------
1 | RJ
(1 row)
postgres=# alter table identity_always alter COLUMN id restart ;
ALTER TABLE
@denishpatel
denishpatel / autopgsqlbackup
Created Dec 7, 2017 — forked from matthewlehner/autopgsqlbackup
Auto PostgreSQL backup script.
View autopgsqlbackup
#!/bin/bash
#
# PostgreSQL Backup Script Ver 1.0
# http://autopgsqlbackup.frozenpc.net
# Copyright (c) 2005 Aaron Axelsen <axelseaa@amadmax.com>
#
# This script is based of the AutoMySQLBackup Script Ver 2.2
# It can be found at http://sourceforge.net/projects/automysqlbackup/
#
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9