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
| 'use strict'; | |
| class LinkList { | |
| constructor() { | |
| this.head = null; | |
| } | |
| addNode(value) { | |
| const node = new Node(value); | |
| if (this.head) { | |
| node.next = this.head; |
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
| image: ubuntu:latest | |
| variables: | |
| WORK_DIR: ${CI_PROJECT_NAME} | |
| BRANCH: ${CI_COMMIT_REF_NAME} | |
| stages: | |
| - staging | |
| - production | |
| staging: |
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
| # 5-fold cross validation | |
| import numpy as np | |
| import pandas as pd | |
| from sklearn.model_selection import KFold | |
| fold5 = KFold(n_splits=5,shuffle=False,random_state=1) | |
| scores = [] | |
| df = pd.read_csv('iris.csv',header=None) | |
| X = df.drop(columns=[4]) | |
| Y = df[4] | |
| knn = KNeighborsClassifier(n_neighbors = 9) |
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
| exports.handler = (event, context, callback) => { | |
| const response = { | |
| statusCode: 301, | |
| headers: { | |
| Location: 'https://google.com', | |
| } | |
| }; | |
| return callback(null, response); | |
| } |
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
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
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
| """ | |
| Give an file as input which has following data | |
| 3 love | |
| 6 computers | |
| 2 dogs | |
| 4 cats | |
| 1 I | |
| 5 you |
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
| function isObject(obj) { | |
| return typeof obj==='object' && !Array.isArray(obj) && obj !== null; | |
| } | |
| // object -> array | |
| function paramStrGen(obj){ | |
| var finalKey = []; | |
| Object.keys(obj).sort().forEach(key => { |
OlderNewer