Skip to content

Instantly share code, notes, and snippets.

@worthapenny
worthapenny / JumpGameTwo.ipynb
Created October 7, 2022 19:42
Jump till the end by the value from each index of an array
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@worthapenny
worthapenny / TwoSum.ipynb
Created October 5, 2022 00:13
For the given array return the indices where the sum of member is equal to the target
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@worthapenny
worthapenny / RomanNumbersToInteger.ipynb
Created October 3, 2022 16:57
Convert Roman Number to Integers
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@worthapenny
worthapenny / ValidateBrackets.ipynb
Created October 3, 2022 16:41
Validate if Brackets are balanced
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@worthapenny
worthapenny / OFW_Remove_Personal_Touches.cs
Created August 30, 2022 13:17
Prepare Water Model to Obfuscate by removing personal information
//
@worthapenny
worthapenny / WaterNetworkObfuscation.py
Last active August 29, 2022 22:59
Obfuscate WaterGEMS/CAD hydraulic model using Tulip
'''
Author: Akshaya Niraula
Created: 2022-08-29
Copyright: Copyright (c) 2021 Akshaya Niraula. See MIT LICENSE for details
'''
'''
NOTE:
This code MUST be executed from Tulip interface.
It cannot run on it's own
@worthapenny
worthapenny / OFW_Notebook_Input_Output.ipynb
Last active June 16, 2022 14:34
OpenFlows Water Notebook Input and Output
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@worthapenny
worthapenny / Excel Range To Json.vb
Created March 17, 2021 12:44
Convert given range in Excel to JSON string
Public Function ToJSON(rng As Range) As String
Dim checkType ' https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/vartype-function
Dim valuePart ' value part of the json
' Make sure there are two columns in the range
If rng.Columns.count < 2 Then
ToJSON = CVErr(xlErrNA)
Exit Function
End If
@worthapenny
worthapenny / combine_csv_files_using_python.py
Created March 12, 2021 22:43
Combine multiple CSVs file into one using pandas of python
import glob
import pandas as pd
csv_dir = r"C:\Path\Where\CSV\Files\Area"
csv_files = glob.glob(f"{csv_dir}\*.csv")
# combined_csv = pd.concat([pd.read_csv(f) for f in csv_files])
csv_dfs = []
counter = 1