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 postgres:15.1-alpine | |
| ENV POSTGRES_USER=admin | |
| ENV POSTGRES_PASSWORD=admin | |
| ENV POSTGRES_DB=database | |
| COPY init.sql /docker-entrypoint-initdb.d/ | |
| # docker build -t db_image . | |
| # docker run -d --name db_container -p 5432:5432 db_image |
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
| pipeline { | |
| agent { | |
| dockerfile { // Pick up the DockerFile in root repo. And excute every command inside the container | |
| args '-u root:sudo' // Run docker run commands with these args | |
| } | |
| } | |
| stages { | |
| stage('Build') { | |
| steps { | |
| sh 'chown -R `id -u` /code' //Change the Permission |
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
| -- Create a function | |
| CREATE FUNCTION full_name (first_name CHAR(20), last_name CHAR(30)) | |
| RETURNS CHAR(55) DETERMINISTIC | |
| RETURN CONCAT(first_name,' ',last_name); | |
| -- Usage. From same Db | |
| SELECT full_name(f_name, l_name) FROM people AS fn | |
| -- Result | |
| --| fn | |
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
| CREATE TABLE races ( | |
| race_id TINYINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
| race_name VARCHAR(30) NOT NULL | |
| )ENGINE=INNODB; | |
| CREATE TABLE characters( | |
| char_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
| char_name VARCHAR(50) NOT NULL, | |
| race_id TINYINT UNSIGNED NOT NULL, | |
| CONSTRAINT `fk_char_race` |
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
| def longestPrefix(data): | |
| n = len(data) | |
| # break the string from middle and start matching left and right string. | |
| # If they are equal return size of any one string else try for shorter lengths on both sides. | |
| for i in range(n//2, 0, -1): | |
| prefix = data[0:i] | |
| suffix = string[n-i:n] | |
| if prefix == suffix: |
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 math | |
| import os | |
| import random | |
| import re | |
| import sys | |
| def minBride(input_): | |
| steps = 0 | |
| input_ = [P-1 for P in input_] |
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
| #!/bin/python3 | |
| import math | |
| import os | |
| import random | |
| import re | |
| import sys | |
| # Complete the rotLeft function below. | |
| def rotLeft(list_, rot): |
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 datetime import date | |
| class Person: | |
| def __init__(self, age, name): # Instance Method. Has access to Object instance | |
| self.age = age | |
| self.name = name | |
| @classmethod | |
| def old_person(cls, name): # Class Method. Factory Method implementation | |
| return cls(age=60, name=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
| """ | |
| * | |
| ** | |
| *** | |
| **** | |
| ***** | |
| """ | |
| len = int(input("Enter a positive number")) | |
| count = 1 | |
| while(count <= len): |
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
| """ | |
| Multiple inheritance with same method name, but no override of parent class | |
| method | |
| """ | |
| class Add: | |
| def perform(self,a,b): | |
| return a+b; | |
| class Subtract: |
NewerOlder