Skip to content

Instantly share code, notes, and snippets.

View devpruthvi's full-sized avatar
🎯
Focusing

Pruthvi Raj devpruthvi

🎯
Focusing
View GitHub Profile
import networkx as nx
import matplotlib.pyplot as plt
class Vertex:
def __init__(self, node):
self.id = node
self.adjacent = {}
import heapq
import math
numTests = int(input())+1
def getminind(l):
return heapq.nsmallest(1, ((k, i) for i, k in enumerate(l)))[0][1]
import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict
from matplotlib import animation
import matplotlib.patches as patches
import math
global_R = 0
sets = [ [0], #see this dummy set it is important, this is set_0
#because initially we add -arr[0] or arr[0] to 0
[10,-10],
[30,-10,10,-30],
[100,20,40,-40,60,-20,-80,0,-60,-100],
[60,0,20,-40,-20,-60]]
# my array is 1 based so ignore the zero
arr = [0,10,20,40,30]
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class temp
{
public static void main(String[] args)
{
@devpruthvi
devpruthvi / clone-all-gists.py
Created July 31, 2016 15:15
Gist to download all public and private gists
#!/usr/bin/python
#Depends on: https://github.com/defunkt/gist and git
#install them first
#then run python clone-all-gists.py
import subprocess,re
gists = subprocess.check_output(['gist','-l'])
gists = re.findall('^.*com\/(.*?)(?:\s|$)',gists,re.M)
for gist in gists:
url = 'https://gist.github.com/%s.git' % gist
//ATOM CONFIG
#!/usr/bin/env python
#Author: Pruthvi Raj ( [email protected] )
#Date: 10-March-2016
import re, copy, random
class TicTacToe:
def __init__(self):
self.magic_square = [8, 1, 6, 3, 5, 7, 4, 9, 2]