Skip to content

Instantly share code, notes, and snippets.

View 5hirish's full-sized avatar
:octocat:
Crunching the code

Shirish Kadam 5hirish

:octocat:
Crunching the code
View GitHub Profile
@5hirish
5hirish / card_format
Created July 7, 2018 10:08
Kanban Card Format
:small_blue_diamond: **Feature Title**
Feature Description, `code example`.
* Docs: [Web Name](https://example.com)
:arrow_forward: @Username
:clock1: 2nd July
@5hirish
5hirish / libinput-gestures.conf
Created July 4, 2018 21:42
libinput-gestures
# Configuration file for libinput-gestures.
#
# The default configuration file exists at /etc/libinput-gestures.conf
# but a user can create a personal custom configuration file at
# ~/.config/libinput-gestures.conf.
#
# Lines starting with '#' and blank lines are ignored. Currently
# "gesture" and "device" configuration keywords are supported as
# described below. The keyword can optionally be appended with a ":" (to
# maintain compatibility with original format configuration files).
N = 4
chess_board = [[0 for i in range(N)] for j in range(N)]
print(chess_board)
queen_position = 1,2
print("Horizontal")
queen_position_horizontal = 2,0
for i in range(N):
print("2,",i)
def solveMaze (Maze , position , N ,destination):
# returns a list of the paths taken
if position == destination:
return [ destination ]
x , y = position
if x + 1 < N and Maze[x+1][y] == 1: # Down
a = solveMaze( Maze , ( x + 1 , y ) , N , destination)
print("At",a)
if a != None:
return [ (x , y ) ] + a
#! /usr/bin/python3
def explore(i, j, grid_map_exp, grid_map):
if i <= 3 and j <= 3:
current = grid_map[i][j]
if current == 's' or current == '-':
explore(i, j+1, grid_map_exp, grid_map)
explore(i, j-1, grid_map_exp, grid_map)
explore(i+1, j, grid_map_exp, grid_map)
"""
E --> nT
T --> *nT | @
"""
def non_terminal_E(input_token, lookahead):
if input_token == "n":
lookahead = match(input_token,"n", lookahead)
non_terminal_T(input_token, lookahead)
def partition(array, first, last):
pivot = array[last]
print "Pivot: ", pivot
index = first
for j in range(first,last):
print "Comparing ", array[j]," and ",pivot
if array[j] <= pivot:
print "Swapping ",array[j], " and ", array[index]
import sys
def search_func(initial, terminal, search_val, elements, position) :
# print (initial," to ",terminal)
difference = terminal - initial
#print "Diff :" , position + difference
elements = elements[initial:terminal]
length = len(elements)
#! /usr/bin/python
import random
def sort_sublist (sort_list): #insertion sort
"Sorts the sub lists using insertion sort"
for j in range(1,len(sort_list)):
key = sort_list[j] #compare with next
i = j - 1
while i >= 0 and sort_list[i] > key: #compare the key with the its left elements...if smaller swap
#! /usr/bin/python
import random
list = list()
t = 0
for i in xrange(10):
list.append(random.randrange(1,100,1)) #generate a list of ten random numbers between 1 and 100
print "The unsorted list : ",list