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
| #!/usr/bin/env bash | |
| main() { | |
| today_date=$(date +%Y%m%d) | |
| key_filename="VMWARE${today_date}.priv" | |
| cert_filename="VMWARE${today_date}.der" | |
| openssl req -new -x509 -newkey rsa:2048 -keyout "${key_filename}" -outform DER -out "${cert_filename}" -nodes -days 36500 -subj "/CN=VMWARE/" |
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
| #!/usr/bin/python3 | |
| from datetime import datetime | |
| from time import sleep | |
| while True: | |
| time_ = datetime.now().strftime("%H:%M:%S:%f")[:-3] | |
| print(f"\r{time_}", end="") | |
| sleep(0.1) |
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
| ssh -i <path/to/my/private/ssh/key> -L <remote_port>:127.0.0.1:<local_port> <user>@<hostname> -N -vv |
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
| # https://stackoverflow.com/questions/1123000/does-python-have-anonymous-classes | |
| anonymous_class = type( | |
| "", | |
| (), | |
| { | |
| "attr1": None, | |
| "get_attr1": lambda self: getattr(self, "attr1"), | |
| "set_attr1": lambda self, value: setattr(self, "attr1", value) | |
| } |
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 calc_base_one_repunits(n): | |
| # https://en.wikipedia.org/wiki/Repunit | |
| return sum( | |
| map(lambda x: pow(10, x), range(0, n)) | |
| ) | |
| for i in range(1, int(input("Triangle size: "))+1): | |
| print(pow(calc_base_one_repunits(i), 2)) |
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 extract_digits_left(num): | |
| if num < 10: | |
| return [num] | |
| else: | |
| return [*extract_digits_left(num // 10), num % 10] | |
| def extract_digits_right(num): | |
| if num < 10: | |
| return [num] |
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
| # https://jaunt-api.com/download.htm | |
| # https://stackoverflow.com/questions/60156835/how-to-deploy-private-jar-to-gitlab-maven-repository* | |
| PROJECT_ID="" | |
| GITLAB_MAVEN_REPOSITORY="" | |
| mvn deploy:deploy-file \ | |
| -DgroupId=com \ | |
| -DartifactId=jaunt \ | |
| -Dversion=1.6.0 \ |
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 urllib.parse import quote, unquote | |
| # https://www.urlencoder.io/python/ | |
| url = "https//hello.world.api.com/v1/print?value=hello world" | |
| quoted = quote("https//hello.world.api.com/v1/print?value=hello world") | |
| unquoted = unquote(quoted) | |
| print(quoted) |
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
| #!/usr/bin/env bash | |
| main() { | |
| ssh_key_path="${1}" | |
| if [[ -z $ssh_key_path ]] | |
| then usage; exit | |
| fi | |
| ssh-add "${ssh_key_path}" | |
| ssh-agent | |
| } |
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 logging | |
| import pickle | |
| from datetime import datetime | |
| from sys import getsizeof | |
| logger = logging.getLogger(__name__) | |
| class CacheStore: |
OlderNewer