Thursday, June 8, 2023
Tuesday, June 6, 2023
Level up your Automation Game
Here's a strategic plan I've been following to help improve my automation programming skills, primarily focusing on Python but also [trying] incorporating some Go.
The efficiency of this plan, similar to many others, hinges on two primary pilars: Deliberate Practice and Consistency
Python Basics and Advanced Concepts: Start by revisiting the Python basics (variables, data types, functions, loops, conditional statements). * Gradually move to more advanced topics (OOP concepts, file handling, exception handling, generators, decorators).
Dive Deeper into Python: Understand Python's standard library. It's broad and powerful, and a lot of what you might want to do for automation might already be covered. * Learn about working with databases, APIs, and web scraping as they are common in automation tasks.
Automation Specific Python Libraries: Learn libraries that are frequently used in automation tasks, like Selenium for web automation, or Pyautogui for GUI automation.
Practice, Practice, Practice: Regular practice is key to mastering any programming language. Try to automate simple tasks that you do daily. It could be anything from organizing your files to web scraping news articles. * Websites like Codewars, LeetCode, and HackerRank provide Python problems that you can practice on.
Go Programming: Once you're confident with Python, start exploring Go. Go is known for its simplicity and efficiency, which can be particularly useful for certain automation tasks. * Begin with the basics (variables, data types, control structures, functions) and move on to more complex topics (pointers, structures, interfaces, concurrency). * Start writing small scripts, then slowly move onto more complex tasks.
Projects: The most effective way to learn is by doing. Apply your skills to real-world projects. These could be work-related or personal projects. * GitHub is a great place to find open-source projects where you could contribute, or get inspiration for your own projects.
Continuous Learning: The tech world is always evolving, so it's crucial to stay up-to-date. Follow relevant blogs, forums, or influencers who can provide insights into the latest trends and best practices.
Remember, it's perfectly okay to feel overwhelmed when learning something new. Be patient with yourself and celebrate your progress, no matter how small it might seem. The key to becoming proficient in any programming language is consistency and practice. Happy coding!
SRE Best Practices: Boosting Reliability, Performance, and Efficiency in the Cloud
Site Reliability Engineering (SRE) is a discipline that combines software engineering principles and practices to create ultra-scalable and highly reliable software systems. Initially developed at Google, SRE has become an industry standard, especially important for cloud-based environments. In this blog post, we'll delve into some SRE best practices to enhance the reliability, performance, and efficiency of services running on hosted cloud environments.
Embrace SLOs, SLIs, and SLAs
Service Level Objectives (SLOs), Service Level Indicators (SLIs), and Service Level Agreements (SLAs) are vital components of SRE. SLIs are the metrics or indicators used to measure the performance and health of a service. SLOs are the target values or range of values for these metrics. SLAs, on the other hand, are the contracts with customers that specify what happens if an SLO is not met.
These elements play an essential role in balancing reliability and the pace of development. They help quantify reliability, make informed decisions about risk, and prevent reliability from becoming an afterthought.
Automate as Much as Possible
Automation is a core tenet of SRE. From deployments and scaling to incident management and remediation, automation drives consistency, reduces human error, and allows your team to focus on more complex tasks. For example, automating the deployment process through CI/CD pipelines helps ensure reliable releases and faster recovery times when issues arise.
Error Budgets and Risk Management
An error budget is the acceptable level of risk or failure defined by the SLO. If a service's reliability exceeds its SLO, the error budget is "positive," and you can take more risks like accelerating feature deployment. However, if the error budget is "negative," it means you're not meeting your SLO and should focus on improving reliability.
Prioritize Incident Management
Despite your best efforts, incidents will occur. Effective incident management includes defining an incident response process, having an on-call rotation, and following up with a blameless postmortem. This approach not only resolves incidents effectively but also turns them into learning opportunities to prevent recurrence.
Embrace a Culture of Learning and Blamelessness
SRE encourages learning from failures instead of blaming. It's important to create a culture where people feel safe to report and learn from mistakes. Blameless postmortems are a key tool in this respect, focusing on identifying the contributing causes of incidents without pointing fingers.
Monitoring and Observability
You can't improve what you can't measure. Comprehensive monitoring and observability are key to understanding your system's behavior and identifying areas for improvement. Utilize logging, metrics, and tracing to gain a full view of your system's performance and health.
Capacity Planning
Capacity planning helps ensure your services can handle the load and meet performance expectations. It includes forecasting demand, managing resource usage, and planning for scalability. It's crucial to use tools for auto-scaling and load balancing in cloud environments to handle sudden traffic spikes or grow over time.
Conclusion
SRE is a powerful approach for managing and improving services running in the cloud. By embracing SRE best practices, you can boost the reliability, performance, and efficiency of your services, ensuring that they not only meet customer expectations but also contribute to the overall success of your business.
Remember that SRE is not just about tools and practices; it's also about culture. By fostering a culture of blamelessness, continuous learning, and a focus on reliability, you can create a robust and resilient cloud ecosystem.
Wednesday, January 20, 2021
Install python2.7 alongside 2.6 on Centos6 or 7
* note this also works with python3 and 2.6.
# Install Dev tools
yum groupinstall -y "development tools"
# Install required libraries
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel expat-devel
# Install wget if you don't already have it
yum install -y wget
# Download Python 2.7.14 package
wget http://python.org/ftp/python/2.7.14/Python-2.7.14.tar.xz
# Unzip it
tar xvf Python-2.7.14.tar.xz
# Go into directory for install
cd Python-2.7.14 Python-2.7.14.tar.xz
# configure python2.7 in /usr/local/bin
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
# Compile it as an alt-install (SUPER CRITICAL STEP!!!). This will allow you to run both existing python and newly installed python
sudo make && sudo make altinstall
Thursday, November 14, 2019
Trim videos quickly using FFMPEG
On a mac, you'll need to install FFMPEG. you can get this from homebrew.
If you don't have homebrew, you can install it easily following the one liner instructions from their site.
Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Once Homebrew is installed, then install FFMPEG via homebrew. Open your terminal and use the following command to install FFMPEG.
brew install ffmpeg
Then run the following command (substitute your input.mp4 and output.mp4 with desired filenames).
ffmpeg -i input.mp4 -ss 00:10:25 -to 01:18:34 -c:v copy -c:a copy output.mp4
This will cut your input.mp4 video file. Start will be 10 minutes and 25 seconds. The end will be 1 hour 18 minutes and 34 seconds. Also, this should take only about 5-10 seconds.
Enjoy!
Wednesday, December 12, 2018
Setup WebPageTest Private Instances
Assumptions: You have docker installed.
docker pull kmaqsudi/wpt-private-server
docker pull kmaqsudi/wpt-private-agent
docker run -d -p 4000:80 kmaqsudi/wpt-private-server
docker run -d -p 4001:80 --network="host" kmaqsudi/wpt-private-agent
Saturday, October 6, 2018
Memory
"We remember what we understand; we understand only what we pay attention to; we pay attention to what we want." - Edward Bolles
- Choose to remember. Be interested. Pay attention. Want to learn and know. What you want is an important part of learning. When people are interested and want to learn, they learn and remember more effectively.
- Visualize or picture in your mind what you wish to remember. For many people, a mental picture or visualization is clearer and easier to remember than words. For each major concept that you want to remember, create a mental picture and then look at it carefully for a few seconds. Once you've seen it clearly, you'll probably be able to recall it.
- Relate the ideas and information you wish to remember to each other and to ideas and information you already know. When you relate information to other information, you create a chain of memories which lead to one another. When you label an information chain or group of ideas, you create a kind of "file" that makes it easy to locate and remember the information.
- Repeat what you wish to learn until you overlearn it. Say it in your own words. Even though you've already learned something, go over it one more time. Research shows that the time you spend on overlearning and putting ideas into your own words will pay off by making recall easier and more complete.
Author: keeleym@bucks.edu
Monday, February 5, 2018
Create SAN certificate CSR on macOS
Assuming that your domains are the following 4 domains
www.example.com
www.example1.com
www.example2.com
www.example3.com
www.example4.com
Step 1:
#Open your terminal app and create a file called sancert.cnf
Step 2:
#In this new file you just created insert the following lines of text.
[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
req_extensions = req_ext
[ req_distinguished_name ]
countryName = Country Name (2 letter code)
stateOrProvinceName = State or Province Name (full name)
localityName = Locality Name (eg, city)
organizationName = Organization Name (eg, company)
commonName = Common Name (e.g. server FQDN or YOUR name)
[ req_ext ]
subjectAltName = @alt_names
[alt_names]
DNS.1 = www.example.com
DNS.2 = www.example1.com
DNS.3 = www.example2.com
DNS.4 = www.example3.com
DNS.5 = www.example4.com
Step 3:
Save your file and go back to your terminal app.
Step 4:
# In your terminal, type the following command (in the same dir as the file you just created)
$ openssl req -out sslcert-example.csr -newkey rsa:2048 -nodes -keyout sslcert-example.key -config sancert.cnf
This will create 2 files.
1. sslcert-example.csr
2. sslcert-example.key
Thursday, October 6, 2016
Revert Git changes
# switch to branch you need to rollback
git checkout branch_name
# make sure you have the updated version
git pull
# rollback to specific version
git reset --hard 56e08f23
# push your changes back to github
git push -f
To remove a specific commit that has been pushed to remote repos
#Identify the commit hash
git revert -m 1 56e08f23
# confirm the revert was correctly done and push back up to remote repos
git push -f
Saturday, February 13, 2016
Hello World
Saturday, October 25, 2014
Yahoo messenger breaks if you upgrade to Yosemite. - fixed
If you upgrade your mac to Yosemite, your yahoo messenger will not work.
All credit to Chris Knight for this fix.
Download the following patched Adium and you're good to go.
http://www.ghostwheel.com/adium-yahoo-fix/Adium.app.zip
Original post can be found here...
http://www.ghostwheel.com/merlin/Personal/notes/tag/yosemite/
-Khalid
Friday, October 3, 2014
Connecting to Citrix Netscaler via browser on a Mac
Open Preferences
Click on Java on the bottom and a new Java console window will open...
In the Temporary internet files section of the 'General' tab, click on 'Settings..."
Then make sure that "Keep temporary files on my computer" is unchecked.
Thursday, July 3, 2014
Are you interested or committed?
Are You Interested Or Committed?
"Interested people do what is convenient. Committed people do whatever it takes."I’ve heard this term applied to entrepreneurs who want to have a successful business. Basically the question is – are you interested or committed to have a successful business?
However, the real question is: Are you interested or committed to achieving your goals?
The one’s you’re interested in or the one’s you’re committed to? Yep, you’re most likely to achieve the goals that you’re committed to. Take another look at those goals that you’re interested in. Be really honest with yourself – why do you want to achieve those goals? Because your friend or colleague did? Because someone else told you that you should? Or because you think you should? Do you really need me to tell you that those reasons probably won’t motivate you?
Can you move from interested to committed? Yep! But you need a better reason than “I want to keep up with the Jones’s”. What does achieving that goal really mean to you? What will change by achieving that goal and how is that different from where you are now? Motivation for a goal you’re committed to comes from within you and not from someone else. It gets you fired up and willing to step outside your comfort zone. It’s powerful.
What goals are you committed to?
Tuesday, June 10, 2014
Kibana 3 with ATG logs
I'm going to give this a shot and see how it goes. The toolchain used in this demo seems bloated though...
source:
http://atgadapt.com/aggregated-logging-for-atg-with-kibana/
Sunday, March 30, 2014
Adium 1.5.9 'connecting' to yahoo!
Problem description:
When using Adium to log into your Yahoo! messanger account, the status remains on 'connecting'. Gtalk/etc, is working fine. As is the default Yahoo! messenger app.
Resolution:
Upgrading to the nightly build version 1.5.10 seems to have solved the issue.
http://nightly.adium.im/adium-adium-1.5.10/Adium_1.5.10hgr5845.dmg
Sunday, March 2, 2014
Live. Love. Matter
This of course, does not describe everyone. Yet we have the average American watching four hours of television per day. This amounts to around 13 years of his or her lifetime. Yes, that's 13 years 24/7 in front of the boob tube. Those years slip by episode-to-episode, and often feel like rest and entertainment. But all research shows they amount to very little joy or meaning in one's day or life.
The cost is immense: had those 13 years been used for vital and productive endeavor, they would amass to nearly $1,000,000 more in wages and over $2,000,000 in investment opportunity. Let's not forget how those 13 years could have been used to deepen friendships, travel, create more art, learn languages, develop world-class expertise, contribute, enjoy love, or live life as a human rather than a gape-mouthed consumer of waste.
While television isn't stealing everyone's four hours, most of us now suffer from a sort of recurring "browser blackout" or "app amnesia," losing hours of time each day on our computer or mobile devices without any recollection of what we saw or accomplished. Distraction reigns.
And so the outcome is we have tremendously engaged and intelligent people often tragically consuming and learning meaningless things. We are busy, but at what? We are smart, but at what? We are engaged, but with what?
Not everyone is so lost, but this might help explain the melancholy one feels in our society. For what could be worse than for smart, engaging people to finish their lifetimes without much to show for it but the ability to win a pop culture trivia contest?
Let us choose once again to aim our ambition and intelligence toward meaningful endeavors. Let's be productive. Let's serve. Let's enjoy this gift of life.
- Brendon Burchard
Tuesday, December 24, 2013
Talk is cheap
- author unknown
Saturday, October 26, 2013
Cisco VPN issue with OS X Mavericks - solved
open a terminal (iterm)
# edit the sysctl.conf file
sudo vim /etc/sysctl.conf
# comment out the following line.
kern.ipc.maxsuckbuf=512000.
Your file should look like this after you edit...
#
# Tuning network for broadband
#
# START
# kern.ipc.maxsockbuf=512000
net.inet.tcp.sendspace=131072
net.inet.tcp.recvspace=358400
# END
# Last step is to reboot.
Saturday, July 6, 2013
Saturday, June 29, 2013
How to get your public IP from command line
How to get your public IP from command line.
wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
Thursday, June 27, 2013
Do The Work
No book, blog, online course or seminar works until the moment you start doing the work
-- Robin Sharma
Friday, June 14, 2013
What is Web Operations?
Very interesting article on Web Operations. Its a bit old but very much still relevant from Theo Schlossnagle. Excellent read.
Thursday, April 18, 2013
FlushDNS cache on Mac OS X and Linux
#flush your DNS cache on your Mac OS X machine
sudo discoveryutil mdnsflushcache
sudo killall -HUP mDNSResponder
sudo /etc/init.d/nscd restart
Wednesday, April 17, 2013
Expand LVM in CentOS 6
# review your disk layout
fdisk -l
# scan for new disk.
echo "- - -" > /sys/class/scsi_host/host0/scan
# check disk layout again {notice changes}
fdisk -l
Thursday, March 28, 2013
Execution is the Key
Monday, March 4, 2013
Thursday, February 7, 2013
Be willing to become a beginner again.
http://blog.developwithpassion.com/2013/02/07/be-willing-to-become-the-beginner-again/
Monday, January 28, 2013
Seth Goden - Beyond Showing up
Beyond showing up
Monday, December 24, 2012
21 tips to get you to your best productivity
Tuesday, December 18, 2012
Using mod_jk1.2 with JBoss
Using mod_jk 1.2.x with JBoss/Tomcat bundle and Apache2
Quick Overview
- Download Apache2
- Download modjk 1.2.x (At least 1.2.27 suggested)
- Change the main Apache config to include modjk config
- Create the modjk config
- Configure the modjk workers (which JBoss/Tomcat nodes Apache uses)
- Configure the Apache URIs served by modjk (the applications served by JBoss/Tomcat)
- Restart Apache
- Configure Tomcat (Give each JBoss/Tomcat a jvmRoute for session stickness)
- Restart JBoss
- Test it
mod_proxy
More Details
# Include mod_jk configuration file
Include conf/mod-jk.conf
# Load mod_jk module
# Specify the filename of the mod_jk lib
LoadModule jk_module modules/mod_jk.so
# Where to find workers.properties
JkWorkersFile conf/workers.properties
# Where to put jk logs
JkLogFile logs/mod_jk.log
# Set the jk log level [debug/error/info]
JkLogLevel info
# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
# JkOptions indicates to send SSK KEY SIZE
# Notes:
# 1) Changed from +ForwardURICompat.
# 2) For mod_rewrite compatibility, use +ForwardURIProxy (default since 1.2.24)
# See http://tomcat.apache.org/security-jk.html
JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories
# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"
# Mount your applications
JkMount /__application__/* loadbalancer
# Let Apache serve the images
JkUnMount /__application__/images/* loadbalancer
# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=loadbalancer
JkMountFile conf/uriworkermap.properties
# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
# Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to
# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452
JkShmFile run/jk.shm
# Add jkstatus for managing runtime data
<Location /jkstatus>
JkMount status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
# Define list of workers that will be used
# for mapping requests
# The configuration directives are valid
# for the mod_jk version 1.2.18 and later
#
worker.list=loadbalancer,status
# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=node1.mydomain.com
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.prepost_timeout=10000 #Not required if using ping_mode=A
worker.node1.connect_timeout=10000 #Not required if using ping_mode=A
worker.node1.ping_mode=A #As of mod_jk 1.2.27
# worker.node1.connection_pool_size=10 (1)
# Define Node2
# modify the host as your host IP or DNS name.
worker.node2.port=8009
worker.node2.host= node2.mydomain.com
worker.node2.type=ajp13
worker.node2.lbfactor=1
worker.node2.prepost_timeout=10000 #Not required if using ping_mode=A
worker.node2.connect_timeout=10000 #Not required if using ping_mode=A
worker.node2.ping_mode=A #As of mod_jk 1.2.27
# worker.node1.connection_pool_size=10 (1)
# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1,node2
# Status worker for managing load balancer
worker.status.type=status
# Simple worker configuration file
#
# Mount the Servlet context to the ajp13 worker
/jmx-console=loadbalancer
/jmx-console/*=loadbalancer
/web-console=loadbalancer
/web-console/*=loadbalancer
/myapp/*=loadbalancer
!/myapp/images/*=loadbalancer
- In JBoss 5, it's $JBOSS_HOME/server/all/deploy/jbossweb.sar/server.xml
- In JBoss 4.2.x and EAP 4.x, it's $JBOSS_HOME/server/all/deploy/jboss-web.deployer/server.xml
- In earlier releases it's $JBOSS_HOME/server/all/deploy/jbossweb-tomcatXX.sar/server.xml where XX is 40, 50, 55 etc depending on the Tomcat version embedded in the AS.
<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
.
</Engine>
<!-- A AJP 1.3 Connector on port 8009 -->
<Connector port="8009" address="${jboss.bind.address}"
emptySessionPath="true" enableLookups="false" redirectPort="8443"
protocol="AJP/1.3" connectionTimeout="600000" maxThreads="200"/>
- In JBoss 5, this step isn't needed.
- In JBoss 4.2.x and EAP 4.x, it's $JBOSS_HOME/server/all/deploy/jboss-web.deployer/META-INF/jboss-service.xml
- In earlier releases it's $JBOSS_HOME/server/all/deploy/jbossweb-tomcatXX.sar/META-INF/jboss-service.xml where XX is 40, 50, 55 etc depending on the Tomcat version embedded in the AS.
<attribute name="UseJK">true</attribute>
JkMount /jmx-console loadbalancer
JkMount /jmx-console/* loadbalancer
<VirtualHost host.name.or.IP>
ServerName host.name.or.IP
JkMount /jmx-console loadbalancer
JkMount /jmx-console/* loadbalancer
</VirtualHost>