-- Information related to index, table size with the scans SELECT t.tablename, indexname, c.reltuples AS num_rows, pg_size_pretty(pg_relation_size(quote_ident(t.tablename)::text)) AS table_size, pg_size_pretty(pg_relation_size(quote_ident(indexrelname)::text)) AS index_size, CASE WHEN indisunique THEN 'Y' ELSE 'N' END AS UNIQUE,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
import math | |
n = range(1,9) # input range | |
lgn = [math.log(x,2) for x in n] #logn | |
l = [x for x in n] # linear | |
nlgn = [x*math.log(x,2) for x in n] # nlogn | |
q = [x**2 for x in n] # quadratic | |
p = [2**i for i in n] # polynomial |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$loops = 100000; | |
$str = "ana are mere"; | |
echo "<pre>"; | |
$tss = microtime(true); | |
for($i=0; $i<$loops; $i++){ | |
$x = crc32($str); | |
} |
I hereby claim:
- I am pranavgarg on github.
- I am pgarg (https://keybase.io/pgarg) on keybase.
- I have a public key whose fingerprint is 70F8 1545 7515 F45C 3441 2FA6 BEFA 817E EB70 BEBE
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatten(l): | |
for el in l: | |
if isinstance(el, collections.Iterable) and not isinstance(el, basestring): | |
for sub in flatten(el): | |
yield sub | |
else: | |
yield el | |
assert [i for i in flatten([1,2,[3,4]])] == [1,2,3,4] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = ['1','2','3','4','5','6','7','8','9'] | |
def josepheus(int_list, skip): | |
skip = skip - 1 #list starts with 0 index | |
idx = 0 | |
output = [] | |
while len(int_list)>0: | |
idx = (skip+idx)%len(int_list) | |
k = int_list.pop(idx) | |
output.append(k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node: | |
def __init__(self, value): | |
self._value = value | |
self._next = None | |
def __repr__(self): | |
return ("Node({!r})".format(self._value)) | |
def reverseList(head): | |
''' | |
reverses a linklist. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##INTRO | |
Docker is based on lxc (Linux Containers) which helps provide virtualization on the host OS. | |
Its lightweight and ease of use allows it to succeed over VMware virtualization. | |
##Useful commands | |
1. **docker ps** - Lists containers. | |
2. **docker logs** - Shows us the standard output of a container. | |
3. **docker stop** - Stops running containers. | |
4. **docker images** - Lists all the docker images |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lists the volumes | |
$> lsblk | |
# this lists all the volumes | |
xvda1 202:1 0 8G 0 disk / | |
xvdb 202:16 0 400G 0 disk /mnt | |
$> free -s /dev/xvdb | |
#would return data is its not yet formatted and doesn't have any data | |
#otherwise would return the block and storage type ext4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
Install: meteor add audit-argument-checks | |
Description: This package will do type checking for the arguments. | |
E.g. Publish function sending data back based on the username | |
### | |
Meteor.publish({ | |
"posts": (currentUserName) -> | |
check currentUserName, String #this line does the typechecking. If missed following error thrown Exception from sub posts id .. Did not check() all arguments during publisher | |
Posts.find({author: currentUserName}).fields({}) | |
}) |
NewerOlder