Skip to content

Instantly share code, notes, and snippets.

View nsdevaraj's full-sized avatar
🎯
Focusing

N.S.Devaraj nsdevaraj

🎯
Focusing
View GitHub Profile
@nsdevaraj
nsdevaraj / counter.sh
Last active March 6, 2024 14:57
get console log to file
count=840
declare -i count
echo "Prepare to launch"
while [[ $count -gt 99 ]]; do
sleep 1
echo "$count"
node tra.js "0"$count
count=$count-1
done
sleep 1
@nsdevaraj
nsdevaraj / repeat text
Created March 5, 2024 02:17
excel repeat text
=TOCOL(TEXTSPLIT(TEXTJOIN("",TRUE,REPT(ROW(C1:C133)&",",C1:C133)),",",,TRUE)*1,3)
=DROP(REDUCE("",E1:E1330,LAMBDA(a,v,VSTACK(a,IFNA(VLOOKUP(v,HSTACK(ROW(A1:A133),A1:B133),{2,3},FALSE),{"",""})))),1)
@nsdevaraj
nsdevaraj / scrap.py
Created March 3, 2024 12:06
blogspot scrapper
"""
This script scrapes a Blogspot blog by iterating back in its history.
Usage:
1. Provide blogspot links
2. Press CTRL-C when you want to stop it.
Note: Your IP-number may be temporarily banned from the Blogger service if over-used.
Use on your own risk.
"""
@nsdevaraj
nsdevaraj / viewController.swift
Created February 8, 2024 13:44
Load any webpage
//
// ViewController.swift
// WebEmbed
//
// Created by Devaraj NS on 08/02/24.
//
import Cocoa
import WebKit
@nsdevaraj
nsdevaraj / multiplycsv.py
Last active February 4, 2024 09:42
raw data css
import pandas as pd
import numpy as np
from datetime import datetime, timedelta
# Read the CSV file
df = pd.read_csv('Rawdata.csv')
# Define the start and end dates
start_date = datetime(2020, 1, 1)
end_date = datetime(2024, 12, 31)
# Generate a list of dates within the specified range
@nsdevaraj
nsdevaraj / macro
Created November 13, 2023 06:08
ppt macro
' Create a new presentation
Set ppt = Presentations.Add
' Add title slide
Set sld = ppt.Slides.Add(1, ppLayoutTitle)
Set shp = sld.Shapes.Title
Set txt = shp.TextFrame.TextRange
txt.Text = "Business Intelligence (BI)"
txt.Font.Size = 44
txt.Font.Bold = True
// Import the d3 library
var d3 = require("d3");
// Define the circle and proportions
var center = {x: 0, y: 0};
var radius = 1;
var proportions = [0.2, 0.3, 0.5];
// Create the Voronoi diagram
var voronoi = d3.voronoi()
import csv
# Open a CSV file for writing
with open('years_and_months.csv', 'w', newline='') as csvfile:
# Create a CSV writer
csvwriter = csv.writer(csvfile)
# Write the header
csvwriter.writerow(['Year', 'Month'])
@nsdevaraj
nsdevaraj / dax.m
Last active October 25, 2023 10:45
generate filter context dax query
FILTERCONTEXT =
VAR OutDateYear = CALCULATE ( IF ( ISCROSSFILTERED ( '[Dim] Date Calendar'[Date].[Year] ), CONCATENATEX(VALUES('[Dim] Date Calendar'[Date].[Year] ), '[Dim] Date Calendar'[Date].[Year] , "',' "), "ALL MEMBERS" ), ALLSELECTED ( '[Dim] Date Calendar' ) )
VAR OutDateMonth = CALCULATE ( IF ( ISCROSSFILTERED ( '[Dim] Date Calendar'[Date-Month] ), CONCATENATEX(VALUES('[Dim] Date Calendar'[Date-Month] ), '[Dim] Date Calendar'[Date-Month] , "',' "), "ALL MEMBERS" ), ALLSELECTED ( '[Dim] Date Calendar' ) )
RETURN
"{'[Dim] Date Calendar.[Date].[Year]' : ['" & OutDateYear&"'], '[Dim] Date Calendar.Date-Month' : ['" & OutDateMonth&"']}"
d_CalStatus_feature.StatusName m_Measure.$ado_OV (Switch)_LE_SavingIncome m_Measure.$ado_OV (Switch)_ACT_SavingIncome m_Measure.count_Feature (Switch)
Not Started 68325.725 88648.675 420
Delayed 3673.671 473.273 83
Medium Risk 8994.867 5537.09 35
High Risk 3365.620 28
On Track 4556.535 3839.560 396
Done 44404.635 90726.700 928
Closed 8122.292 0265.905 59