Skip to content

Instantly share code, notes, and snippets.

*Main> printSierpinski 5
*
* *
* *
* * * *
* *
* * * *
* * * *
* * * * * * * *
* *
sier 0 = ["*"]
sier n = [blanks ++ row ++ blanks | row <- mat, let blanks = replicate (2^(n - 1)) ' '] ++ [row ++ " " ++ row | row <- mat]
where mat = sier (n - 1)
printSierpinski n = mapM_ putStrLn $ sier n
@jithusunny
jithusunny / output_life.py
Created February 29, 2012 18:18
o/p of life
jisuka@HCL:~/git/Life$ python life.py
Enter the size of universe: 12
Enter the number of live cells:4
Now, please enter the live cell co-ordniates
-5 5
-5 6
-5 7
-6 6
day 1
@jithusunny
jithusunny / life.py
Created February 29, 2012 17:56
Conway's game of life
#!/usr/bin/python
import time, sys
SIZE = int(raw_input('Enter the size of universe: '))
stable = False
def read_coord(live):
num = int(raw_input('Enter the number of live cells:'))
print('Now, please enter the live cell co-ordniates')
@jithusunny
jithusunny / pascal.lisp
Created September 26, 2011 06:28
Pascal lisp
(defun element_at (row position)
"Finds out the position'th element in the row'th row in Pascal's triangle"
(if (or (= position 0) (= row position))
1
(+ (element_at (- row 1) (- position 1)) (element_at (- row 1) position))))
@jithusunny
jithusunny / pascal.c
Created September 25, 2011 07:52
pascal
/*Filename: pascal.c
Blog: http://jithusunnyk.blogspot.com/
Date: 24-09-11
Description: Finds out the number at any given location(row, position) of Pascal's triangle.
Row-one is conventionally enumerated as 0 & position-one as 0, position-two as 1, etc*/
#include <stdio.h>
int element_at(int row,int pos) {
if (pos == 0 || pos == row)
Ciphertext: wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj
Plaintext: the quick brown fox jumps over the lazy dog
jisuka@HCL:~/git/Python/Caesar$ python caesar.py
Enter the cipher: "Jan hxd fjclqrwp luxbnuh?"
"Kbo iye gkdmrsxq mvycovi?"
"Lcp jzf hlenstyr nwzdpwj?"
"Mdq kag imfotuzs oxaeqxk?"
"Ner lbh jngpuvat pybfryl?"
"Ofs mci kohqvwbu qzcgszm?"
"Pgt ndj lpirwxcv radhtan?"
"Qhu oek mqjsxydw sbeiubo?"
"Riv pfl nrktyzex tcfjvcp?"
#!/usr/bin/python
#Date: Sept 19, 2011
#Filename: caesar.py
#Code for deciphering Caesar-Cipher
#Author: Jithu Sunny
#Blog: http://jithusunnyk.blogspot.com/
#Email: [email protected]
@jithusunny
jithusunny / resultmanager - output
Created March 26, 2011 07:03
Output of resultmanager program
jithu@HCL:~/Dropbox/Public$ ./resultmanager.py
Enter the url of result page of first(any) student from university website: http://202.88.252.6/exams/results1/btechNEW/btechresults_display.php?id=816&regno=etaiecs002&Submit=Submit
Enter the total marks: 1200
Enter the total number of students: 72
Roll number Total Percentage
----------- ----- ----------
etaiecs001 796 - 66.33
etaiecs002 785 - 65.42
etaiecs003 909 - 75.75