Kubernetes - How to Set Namespace So You Do Not Need to Mention it Again and Again in Kubectl Commands.
Introduction In some of the cases, we need to specify namespace name along with…
September 14, 2018
I was testing a bug where a field was limited to 255 characters only. I needed to generate a string of more than 255 characters.
The simplest code I found:
# Generate string of only character 'a' 300 times
'a' * 300
This will generate a string of 300 characters
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa......
Or, you can mix characters
'a' * 100 + 'b' * 100 + 'hey master'
def gen(character, length):
return character * length
# to use
>>> gen('a',20)
'aaaaaaaaaaaaaaaaaaaa'
>>> gen('a',20) + gen('b',10)
'aaaaaaaaaaaaaaaaaaaabbbbbbbbbb'
Using module random
import string
import random
# for upper case ascii characters, and 10 characters long
''.join(random.choice(string.ascii_uppercase) for _ in range(10))
# In a method
def generate(characters=string.ascii_uppercase, length = 10):
return ''.join(random.choice(characters) for _ in range(length))
>>> generate()
'GSPUYMYMLB'
# For having upper case as well as numerics
>>> generate(characters=string.ascii_uppercase + string.digits)
'X9O814PS58'
# For longer string
>>> generate(characters=string.ascii_uppercase + string.digits, length=20)
'7HCYBJAQP9N48TC179Q8'
Introduction In some of the cases, we need to specify namespace name along with…
I have a Java project and dependencies are being managed through maven. I have…
Introduction In this post, we will see a sample Jenkin Pipeline Groovy script…
I have a custom content type, and there are around 2000 number of nodes in my…
Introduction In last post, we saw How to read CSV with Headers into Dictionary…
This post is dedicated for cases where we intend to append a variable value in a…
Introduction In this post we will see following: How to schedule a job on cron…
Introduction There are some cases, where I need another git repository while…
Introduction In this post, we will see how to fetch multiple credentials and…
Introduction I have an automation script, that I want to run on different…
Introduction I had to write a CICD system for one of our project. I had to…
Introduction Java log4j has many ways to initialize and append the desired…