Skip to content

Instantly share code, notes, and snippets.

View debuggerpk's full-sized avatar
🖖
whatever you seek is seeking you - Rumi

Yousuf Jawwad debuggerpk

🖖
whatever you seek is seeking you - Rumi
View GitHub Profile
@debuggerpk
debuggerpk / file-reader.js
Created January 5, 2017 23:25
angular directive example
'use strict';
export default function fileReader($q) {
'ngInject';
return {
restrict: 'E',
scope: {
label: '@',
accept: '@',
maxSize: '@',
@debuggerpk
debuggerpk / managers.py
Created January 5, 2017 23:20
Unique for M2M fields
from django.db.models import QuerySet, Manager
class BaseRankManager(Manager):
def rank(self, field_name, user_id, **kwargs):
"""
Gets unique items from the datebase based on the foreign key. this
queryset is ordered in reverse chronological order.
Args:
@debuggerpk
debuggerpk / cv.sql
Last active December 30, 2016 08:18
creating view
CREATE VIEW "lineitems_vista" AS
SELECT
id,
created_at,
updated_at,
shift_id,
itms.name as name,
quantity,
transaction_id,
itms.price as unit_price,
CREATE CONSTRAINT ON (n:Address) ASSERT n.node_id IS UNIQUE;
CREATE CONSTRAINT ON (n:Officer) ASSERT n.node_id IS UNIQUE;
CREATE CONSTRAINT ON (n:Entity) ASSERT n.node_id IS UNIQUE;
CREATE CONSTRAINT ON (n:Intermediary) ASSERT n.node_id IS UNIQUE;
USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM "file:///Addresses.csv" AS line
CREATE (n:Address {node_id: line.node_id })
SET n += line;
@debuggerpk
debuggerpk / topo.json
Created January 25, 2016 11:41
us-topo-.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@debuggerpk
debuggerpk / topo.json
Created January 25, 2016 11:41
us-topo-.json
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@debuggerpk
debuggerpk / dump.sql
Created January 21, 2016 20:19
correct pg_dump for amazon rds
SELECT exec('ALTER TABLE ' || quote_ident(s.nspname) || '.' || quote_ident(s.relname) || ' OWNER TO rds_superuser;')
FROM (
SELECT nspname, relname
FROM pg_class c JOIN pg_namespace n ON (c.relnamespace = n.oid)
WHERE nspname in ('tiger','topology') AND
relkind IN ('r','S','v') ORDER BY relkind = 'S')
s;
@debuggerpk
debuggerpk / .bashrc
Created September 27, 2015 21:28 — forked from vsouza/.bashrc
Golang 1.4.1 setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@debuggerpk
debuggerpk / django_angular.py
Created September 19, 2014 15:08
Dynamic partials loading with django and angular
# urls.py
url(r'partials/(?P<template_name>.+\.html?$)', PartialView.as_view()),
# views.py
class PartialView(TemplateView):
def get_template_names(self):
template_name = 'partials/' + self.kwargs['template_name']
return [template_name]
[root@zimbra ~]# dig zimbra.debugger.pk any
; <<>> DiG 9.3.6-P1-RedHat-9.3.6-20.P1.el5_8.6 <<>> zimbra.debugger.pk any
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43483
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;zimbra.debugger.pk. IN ANY