Skip to content

Instantly share code, notes, and snippets.

@thomasjk10
thomasjk10 / t1.py
Last active October 18, 2018 21:05
''' String compression'''
def is_substring(longstr, substr):
return longstr.find(substr)
def strrotation(s1, s2):
if len(s1) == len(s2) != 0:
return is_substring(s1 + s1, s2) != -1
return False
@thomasjk10
thomasjk10 / Proj1.py
Last active July 2, 2018 13:07
Python Project
#################################################################################
# Project to simulate the game of SIM based on user inputs #
#################################################################################
#################################################################################
# Program written by : Thomas Jude Rakesh #
# Program submitted date : 05/06/2018 #
# Program last modified : 01/07/2018 #
#################################################################################
from random import randint
@thomasjk10
thomasjk10 / Python Notes
Last active July 2, 2018 14:21
Notes for Python learned on Coursera
Python Introduction:
***********************
• Variables, constants
variable can start with letter or _ not number or any special character can be included
• Operators - add, subtract, multiply, divide, %(to get remainder), **(for power)
Comparison operators - ==, <=, >= !=
• indentation matters
• Numeric expressions and operators for solving numeric calculations
• Integer, Float, String are types of expressions/variables
• Conversion of a numeric value in strings can be converted to int or float
@thomasjk10
thomasjk10 / Sort JCL.txt
Last active October 24, 2017 11:07
SORT JCL- Include cond
//D1RXO7ET JOB 'TST - SORTRT',NOTIFY=D1RXO7E,CLASS=1,MSGCLA
//*---SORT EXTRACT REPORT *******
//STEP001 EXEC PGM=SORT
//SORTIN DD DSN=D1RXO7E.TEST.JOB.INPUT1,DISP=SHR
//SORTOUT DD DSN=D1RXO7E.TEST.JOB.OUTPUT,DISP=SHR
//SYSOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(30,8,CH,EQ,C'P#1SPW90',AND,
6,2,FS,GE,30,AND,
By using IEBEDIT:
We can also use IEBEDIT to achieve the same.By using IEBEDIT ,some steps can be included or excluded from running.
Sample job:
//STEP0001 EXEC PGM=IEBEDIT
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=RACFID.JCLLIB(IEBCHK),DISP=SHR
//SYSUT2 DD SYSOUT=*
//SYSIN DD *
@thomasjk10
thomasjk10 / fol_link.py
Last active March 25, 2023 07:25
Following links in python using Beautiful Soup
@thomasjk10
thomasjk10 / reg_exp.py
Created October 5, 2016 05:55
Regular expressions extraction
import re
input = raw_input('Enter file' )
in_fil = open(input)
for line in f:
line = line.strip()
get_num = re.findall('[0-9]+', line)
for num in get_num:
sum_num = sum_num + int(num)
print sum_num
@thomasjk10
thomasjk10 / geojson.py
Created October 4, 2016 16:11
Geo JSON
import urllib
import json
# serviceurl = 'http://maps.googleapis.com/maps/api/geocode/json?'
serviceurl = 'http://python-data.dr-chuck.net/geojson?'
while True:
address = raw_input('Enter location: ')
if len(address) < 1 : break
@thomasjk10
thomasjk10 / Json_extract.py
Last active October 4, 2016 16:12
Using Json and Python
import json
import urllib
url = raw_input('Enter URL:')
input = urllib.urlopen(url)
data = input.read()
info = json.loads(data)
print info
sum_cnt = 0
print info[0]['comments']
@thomasjk10
thomasjk10 / Test.py
Last active September 21, 2016 15:53
# Use the file name mbox-short.txt as the file name
fname = raw_input("Enter file name: ")
fh = open(fname)
fr = fh.read()
fs = fr.strip()
sum_conf = 0
count = 0
for line in fh:
if not line.startswith("X-DSPAM-Confidence:") :
continue