This file contains hidden or 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
import pandas as pd | |
from pymongo import MongoClient | |
import json | |
def mongoimport(csv_path, db_name, coll_name, db_url='localhost', db_port=27000) | |
""" Imports a csv file at path csv_name to a mongo colection | |
returns: count of the documants in the new collection | |
""" | |
client = MongoClient(db_url, db_port) | |
db = client[db_name] |
This file contains hidden or 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
type TRequestType = "GET" | "POST" | "PUT" | "PATCH"; | |
export const loaderAction = async ({ | |
params, | |
request, | |
}: { | |
params: Object; | |
request: Request; | |
}) => { | |
const data = await request.formData(); |
This file contains hidden or 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
:: In environment variables set JAVA_HOME as the latest jdk then set PATH as %JAVA_HOME%\bin | |
@echo off | |
if "%~1" == "15" ( | |
set "JAVA_HOME=C:\Program Files\Java\jdk-15.0.2" | |
echo JAVA 15 Activated. | |
) else if "%~1" == "8" ( | |
set "JAVA_HOME=C:\Program Files\Java\jdk1.8.0_331" | |
echo JAVA 8 Activated. | |
) | |
set "Path=%JAVA_HOME%\bin;%Path%" |
This file contains hidden or 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 pymongo import MongoClient | |
cur=MongoClient(MONGO_HOST,MONGO_PORT) | |
# create db, if db dosen't exsists | |
db=cur[DB_NAME] | |
# create collection, if db dosen't exsists | |
col=db[COLLECTION_NAME] |
This file contains hidden or 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
#decorators take a function as input and enhances it and returns the function | |
# function within a function which adds some features to the function and returns it | |
def decor(num): | |
def inner(): | |
print("enhanced") | |
num() | |
return inner | |
def num1(): |
This file contains hidden or 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 string import ascii_lowercase | |
from words import get_random_word | |
def get_num_attempts(): | |
"""Get user-inputted number of incorrect attempts for the game.""" | |
while True: | |
num_attempts = input( | |
'How many incorrect attempts do you want? [1-25] ') | |
try: |
This file contains hidden or 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
QuestionNo=int(input()) | |
ParticipentNo=int(input()) | |
DefaultKey=input() | |
KeyRecord={} | |
lastkey=[0]*QuestionNo*5 | |
def keyer(key,DK=False): | |
lastkeyindex=0 | |
if not DK: | |
for y in range(ParticipentNo): |
This file contains hidden or 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
testCases=int(input()) | |
for y in range(testCases): | |
string=input() | |
Ch=0 | |
index=string.find(" ") | |
M=int(string[:index]) | |
string=string[index+1:] | |
index = string.find(" ") | |
R1 = int(string[:index]) |