This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Optional,Any,Literal | |
def object_item(target:object): | |
for key in target.__dict__: | |
value = getattr(target,key) | |
if(key.find("__") == -1): | |
yield (key,value) | |
def type_convert(var:Any): | |
SQLType = { | |
"str":"varchar", | |
"int":"int", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* [IParser description] | |
* @param {string} ip IPv4 string | |
*/ | |
function IParser(ip) { | |
let ipValue = 0 | |
let temp = ip.split("."); | |
for (let i = 0; i < temp.length; i++) { | |
ipValue += Number(temp[i]) * Math.pow(0x100, 3 - i) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class IP: | |
ip:str | |
integer:int | |
def __init__(self,address=0): | |
if isinstance(address,int): | |
self.integer = address | |
self.ip = self.toString(address) | |
if isinstance(address,str): | |
self.ip = address | |
self.integer = self.toInteger(address) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fs = require("fs") | |
function ReadJSON(fileName=''){ | |
var strList = fileName.split("."); | |
var string; | |
if(strList[strList.length-1].toLowerCase()=="json"){ | |
string = fs.readFileSync(fileName); | |
} | |
return JSON.parse(string.toString()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def readJSON(fileName=""): | |
import json | |
if fileName!='': | |
strList = fileName.split(".") | |
if strList[len(strList)-1].lower() == "json": | |
with open(fileName,mode='r',encoding="utf-8") as file: | |
return json.loads(file.read()) |