Skip to content

Instantly share code, notes, and snippets.

Avatar
😎
¯\_(ツ)_/¯

Vishwaraj Anand vishwarajanand

😎
¯\_(ツ)_/¯
View GitHub Profile
View main.py
"""
Write a Python program that generates a list containing integers of random values. The program should take in user inputs for the list length and range of integer values. User-dened functions should be used in the program. The program should print out:
1. The generated list
2. List length
3. Largest integer
4. Smallest integer
5. Total sum of the integers in the list
6. Average of the integers in the list
View goal.txt
Write a Python program that implements the ‘Shiritori" (first letter. last letter) game. In this game, a person starts with a word. and the next person has to come up with a word that starts with the last letter of the previous word. (e.g.. If the first person starts with "apple", the next person has to come up with a word that starts with the letter ‘e'.)
Rules of the game:
1. Word must be a valid word.
2. Word must not have been used before.
3. Word must begin with the last letter of the previous word.
The Python program should take in an input word and check whether it exists in the database of words. If the word does not violate any rule of the game. it is deemed valid and the game continues. Else. the game ends.
The database of words would be the provided "word_list.txt" file. The program should open the "word_list.txt" file for reading, then read and store the contents of the file into a suitable Python data type.
@vishwarajanand
vishwarajanand / nginx.conf for CORS
Created Jul 17, 2018
Excerpts from my nginx config which helped me to skip CORS issue where cross origin requests are not allowed
View nginx.conf for CORS
server {
# Nginx listens at this address, http://172.17.0.1:4321
listen 4321;
server_name 172.17.0.1;
# Nginx listens to this location when calls are made to http://172.17.0.1:4321/location1
location ~ /location1 {
# we could have set any server here, lets call this server 1.
proxy_pass http://172.17.0.1:1234;
# add a header for host, keep it same all across
@vishwarajanand
vishwarajanand / CreativePerformance.js
Last active Jun 29, 2019
Creative performance Facebook Scripting Engine script
View CreativePerformance.js
Logger.log('Starting script to generate creatives impressions performance');
let creatives_performance_map = {};
const account = AdAccount.myAccount();
const campaigns = account.getCampaigns()
.loadName()
.loadId()
.setEffectiveStatus(['ACTIVE'])
.execute();
@vishwarajanand
vishwarajanand / splitting_excel_workbook.md
Last active Aug 22, 2019
Split excel workbook into several files with fewer rows
View splitting_excel_workbook.md

I faced some difficulty in splitting a large Excel file into several smaller ones with fewer rows. Here is a quick solutions for the same:

Open file to split -> Developer menu -> Visual Basic menu -> Insert menu -> new module submenu -> paste the following code and click on green run button.

Sub Test()
  Dim wb As Workbook
  Dim ThisSheet As Worksheet
  Dim NumOfColumns As Integer
  Dim RangeToCopy As Range
View PrintExcelSelection.bas
' Helps set print area of a worksheet so that print preview doesn't overflow
Public Sub PrintExcelSelection()
Dim ws As Worksheet: Set ws = ThisWorkbook.ActiveSheet
With ws.PageSetup
.Orientation = xlLandscape
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1
.PrintArea = ActiveCell.CurrentRegion.Address
@vishwarajanand
vishwarajanand / print_log.js
Created Jan 11, 2022
npm log checker script
View print_log.js
console.log("Date", new Date());
console.log("npm works fine!");
@vishwarajanand
vishwarajanand / yt_video_availability.js
Created Feb 17, 2022
JS snippet to check whether a YouTube video is available or not
View yt_video_availability.js
// Load a YT URL like https://www.youtube.com/watch?v=XYZABC
let is_not_available = ["video unavailable", "video isn't available"].
some(needle =>
document.getElementById("contents").textContent.toLowerCase().includes(needle));
@vishwarajanand
vishwarajanand / SBI-PDF-Statement-cracker.py
Created Mar 9, 2022
Crack open your SBI PDF Statements if forgot the registered phone number
View SBI-PDF-Statement-cracker.py
# 1: Install pdfplumber from terminal : `pip3 install pdfplumber`
# 2: Save bank statement to a folder as `savings_bank_account_statement.pdf`
# 3: Password is of the format: <last 5 digit of a mobile number><dob>
# 4: Download `SBI-PDF-Statement-cracker.py` file and save to the same folder
# 5: Run this program from terminal as `python3 SBI-PDF-Statement-cracker.py`
import pdfplumber
dob = '131255' # ddmmyy format, dob value is randomized for privacy
for i in range (10000,100000):
pwd = str(i) + dob
@vishwarajanand
vishwarajanand / php.ini
Created Jul 14, 2022
php.ini configs for Google Cloud Platform
View php.ini
extension=protobuf.so
extension=grpc.so
; extension=php_openssl.so
; extension=xdebug.so
[Xdebug]
zend_extension=xdebug.so
;xdebug.mode=coverage
;xdebug.start_with_request=yes