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
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
Vagrant.configure("2") do |config| | |
# The most common configuration options are documented and commented below. | |
# For a complete reference, please see the online documentation at | |
# https://docs.vagrantup.com. |
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
# set the Default Static Variable | |
# if already set Environment variable, please comment this section | |
SRC_PATH=/opt/b # src to read recommend full path | |
DEST_PATH=/opt/a # encrypted to | |
# assume that the expect output file format is .txt | |
# Also, make sure that you import the private key before running the file via | |
# gpg --import private.key | |
for FILE in $(ls *.gpg) |
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
import json | |
import requests | |
URL = 'https://gitlab.com/api/v4/projects' | |
API_KEY = '' | |
payload = {'private_token' : API_KEY,'simple' : True} | |
def main(): | |
''' make the connection to local gitlab ''' | |
conn = requests.get(URL,params=payload) | |
dict_result = json.loads(conn.text) |
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
# you can write to stdout for debugging purposes, e.g. | |
# print "this is a debug message" | |
def solution(A): | |
# write your code in Python 2.7 | |
# Split list into 2 list | |
if len(A) == 0: | |
return 0 | |
if len(A) == 1: | |
return A[0] |
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
#!/usr/bin/python3 | |
def main(): | |
a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] | |
b = [i for i in a if i % 2 == 0] | |
print(b) | |
if __name__=='__main__': |
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
#!/usr/bin/python3 | |
def main(): | |
text = input("Please enter the text to test : ") | |
if text == text[::-1]: | |
print("This text is palindrome.") | |
else: | |
print("This text is not palindrome.") |
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
#!/usr/bin/python3 | |
def main(): | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] | |
ans = list(set([num for num in a if num in a and num in b])) | |
print(ans) | |
if __name__ =='__main__': | |
main() |
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
#!/usr/bin/python3 | |
def main(): | |
ref = input("Please enter the divisor : ") | |
print([ans for ans in range(2,10) if ans % ref == 0]) | |
if __name__ == '__main__': | |
main() |
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
#!/usr/bin/python3 | |
# Take a list, say for example this one: | |
# a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
# and write a program that prints out all the elements of the list that are less than 5. | |
# Extras: | |
# 1. Instead of printing the elements one by one, make a new list that has all the elements less than 5 from this list in it and print out this new list. | |
# 2. Write this in one line of Python. |
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
#!/usr/bin/python3 | |
import sys | |
def main(): | |
num = input("please enter the number : ") | |
if num.isnumeric() != True: | |
print("Please enter the number") | |
sys.exit(1) | |
if num % 2 == 0: | |
print("this number is even") |
NewerOlder