Posts

Showing posts from 2018

Sample data to practice regex.

Copy paste the below text data, in order to practice RegEx. Link of the  video  for  learning basics of Regex : Learn Regular Expressions step by step. 209.160.24.63 - - [28/Feb/2018:18:22:16] "GET /product.screen?productId=WC-SH-A02&JSESSIONID=SD0SL6FF7ADFF4953 HTTP 1.1" 200 3878 "http://www.google.com" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5" 349 209.160.24.63 - - [28/Feb/2018:18:22:16] "GET /oldlink?itemId=EST-6&JSESSIONID=SD0SL6FF7ADFF4953 HTTP 1.1" 200 1748 "http://www.buttercupgames.com/oldlink?itemId=EST-6" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.46 Safari/536.5" 731 209.160.24.63 - - [28/Feb/2018:18:22:17] "GET /product.screen?productId=BS-AG-G09&JSESSIONID=SD0SL6FF7ADFF4953 HTTP 1.1" 200 2550 "http://www.buttercupgames.com/product.screen?productId=BS-AG-G09"...

Number od Odd days in each month.

This post has the table which represents the number of odd days in every month, in order to calculate the day of any date. The entire trick to calculate the day of any date, visit:  Calculate day of any date. Fastest method. Also, the third column shows the ways to remember the number of odd days. Month                              Number of odd days          Mnemonic January                            6*                                        Winter (6 letters) February                          2**                                      2nd month M...

Source type configurations for Splunk in web scarping

[cricbuzz] category = Custom description = data from cricbuzz.com pulldown_type = 1 SHOULD_LINEMERGE = false LINE_BREAKER = *\)([\r\n]+)

Splunk dashboard HTML code

<form>   <label>Cricket for you</label>   <description>Check the details of the ongoing cricket match.</description>   <fieldset submitButton="false" autoRun="true">     <input type="time" token="time_tok" searchWhenChanged="true">       <label>Time</label>       <default>         <earliest>-15m</earliest>         <latest>now</latest>       </default>     </input>     <input type="dropdown" token="country_tok" searchWhenChanged="true">       <label>Country</label>       <fieldForLabel>country</fieldForLabel>       <fieldForValue>country</fieldForValue>       <search>         <query>index=cricket_score sourcetype=cric...

Script for web scraping

# -*- coding: utf-8 -*- import requests import bs4 import lxml res = requests.get('https://www.cricbuzz.com/cricket-match/live-scores') type(res) soup = bs4.BeautifulSoup(res.text, 'lxml') type(soup) list1 = [] for i in soup.select('.cb-lv-scrs-col'): a= i.text.encode("utf-8") b = a.decode('utf8').encode('ascii', errors='ignore') print (b + '\n') list1.append(b)