I hereby claim:
- I am devanr on github.
- I am devan (https://keybase.io/devan) on keybase.
- I have a public key whose fingerprint is 587D 62C5 69A8 8E79 A983 81B0 5D3B 86BC F834 F237
To claim this, I am signing this object:
class ExportOrder(SpecificRoleRequiredMixin, View): | |
allowed_roles = [SALES_ADMIN, SALES_USER] | |
def get(self, request, *args, **kwargs): | |
response = HttpResponse(content_type='text/csv') | |
response['Content-Disposition'] = 'attachment; filename="wholesale_billing.csv"' | |
orders = Order.objects.all().order_by('created_on') | |
field_mapping = OrderedDict([ | |
# CSV header: Order model field, |
tuple = ('71.201.176.194', '-', '-', '26/Feb/2008:10:30:08 -0600', | |
'GET', '/ply/ply.html', 'HTTP/1.1', '200', '97238') | |
colnames = ('host','referrer','user','datetime', | |
'method','request','proto','status','bytes') | |
dict = (dict(zip(colnames,t)) for t in tuples) |
SELECT table_name, pg_relation_size(table_name), pg_size_pretty(pg_relation_size(table_name)) | |
FROM information_schema.tables | |
WHERE table_schema = 'public' | |
ORDER by 2 DESC; |
SELECT pg_size_pretty(pg_database_size('dbname')); |
#!/bin/bash | |
/usr/bin/curl http://localhost:8080/git/notifyCommit?url=file:///Users/dre09/Workspace/git-bskyb-com/bms |
#!/bin/bash | |
#ref:https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks | |
while read oldrev newrev ref | |
do | |
if [[ $ref =~ .*/master$ ]]; | |
then | |
echo "Master ref received. Deploying master branch to production..." | |
git --work-tree=/var/www/html --git-dir=/home/demo/proj checkout -f |
def generate_random_string(chars=string.ascii_uppercase + string.digits): | |
""" | |
Generates a random string for input testing. | |
Ref: https://stackoverflow.com/questions/2257441/random-string-generation-with-upper-case-letters-and-digits-in-python | |
""" | |
size=random.randint(1, 10) | |
return ''.join(random.choice(chars) for _ in range(size)) |
DROP SCHEMA public CASCADE; | |
CREATE SCHEMA public; | |
GRANT ALL ON SCHEMA public TO postgres; | |
GRANT ALL ON SCHEMA public TO public; | |
COMMENT ON SCHEMA public IS 'standard public schema'; |
# Dump all table beginning with wholesale from metro | |
pg_dump -c -t "^wholesale*" -f wholesale.sql metro | |
# Specific db and user | |
/usr/pgsql-9.4/bin/pg_dump -c -d<database> -U<user> -t "^wholesale*" -f wholesale.backup | |
# Clear table in target database | |
delete from public.wholesale_bearerrate; | |
# Load data in postgres database | |
psql metro < wholesale.sql |
I hereby claim:
To claim this, I am signing this object: