Skip to content

Instantly share code, notes, and snippets.

@actionjack
actionjack / gist:d26122385b050b00476d8ca0c53d67b8
Created December 5, 2023 09:14
Judo Principles in DevOps: Leveraging Martial Arts for Agile Success
Applying judo techniques to DevOps may initially sound unconventional, but it's a useful metaphor for understanding and improving DevOps practices. Judo, a martial art known for its principle of using an opponent's force against them rather than directly opposing it, can offer valuable insights into DevOps processes. Here are a few ways to apply judo principles to DevOps:
Leverage Existing Momentum (Seiryoku Zen'yō - Maximum Efficiency with Minimum Effort): In DevOps, this translates to utilizing existing tools and processes efficiently rather than reinventing the wheel. For instance, if certain automation tools are already in place and working well, build upon them instead of replacing them without a substantial reason.
Adapt and Overcome (Jū no Ri - Flexibility): Just like a judo practitioner adapts to their opponent's movements, in DevOps, it's crucial to be flexible and responsive to changing requirements and environments. This could mean adapting to new technologies, altering workflows to accommodate t
# Source: https://gist.github.com/vfarcic/78c1d2a87baf31512b87a2254194b11c
###############################################################
# How To Create A Complete Internal Developer Platform (IDP)? #
# https://youtu.be/Rg98GoEHBd4 #
###############################################################
# Additional Info:
# - DevOps MUST Build Internal Developer Platform (IDP): https://youtu.be/j5i00z3QXyU
# - How To Create A "Proper" CLI With Shell And Charm Gum: https://youtu.be/U8zCHA-9VLA
@actionjack
actionjack / gist:c7923ba533be096fb7a72b061c508cba
Created August 15, 2023 14:29 — forked from gmhawash/gist:4043232
Reset jenkins password
0. SSH to server
1. Edit /opt/bitnami/apps/jenkins/jenkins_home/config.xml
2. set userSecurity to false: <userSecurity>false</userSecurity>
3. delete
<authorizationStrategy> and <securityRealm>
4. /etc/init.d/bitnami restart
@actionjack
actionjack / create_sparse_file.sh
Created March 13, 2023 13:14 — forked from CMCDragonkai/create_sparse_file.sh
CLI: Creating Sparse Files (Can be used for virtual loopback block devices)
#!/usr/bin/env bash
# seems to work on any filesystem
# final size is (bs * seek) in bytes
# this creates a 4MB sparse file
dd if=/dev/zero of=/tmp/file bs=1 count=0 seek=4194304
# or
@actionjack
actionjack / lambda_function.py
Created November 29, 2022 21:06 — forked from yuyasugano/lambda_function.py
image tweet with S3 in Lambda
import os
import sys
import uuid
import boto3
import tweepy
from urllib.parse import unquote_plus
# Twitter authentication variables
consumer_key = os.environ.get('TWITTER_CONSUMER_KEY', 'ap-northeast-1')
consumer_secret = os.environ.get('TWITTER_CONSUMER_SECRET', 'ap-northeast-1')
@actionjack
actionjack / debug_requests.py
Created September 30, 2022 15:07 — forked from Daenyth/debug_requests.py
Enable debug logging for python requests
import requests
import logging
import httplib
# Debug logging
httplib.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
req_log = logging.getLogger('requests.packages.urllib3')
req_log.setLevel(logging.DEBUG)
AWS_ROOT_CA_FILE=$HOME/aws.root.ca.bundle.pem
cp /dev/null $AWS_ROOT_CA_FILE
for ca in \
https://www.amazontrust.com/repository/AmazonRootCA1.pem \
https://www.amazontrust.com/repository/AmazonRootCA2.pem \
https://www.amazontrust.com/repository/AmazonRootCA3.pem \
https://www.amazontrust.com/repository/AmazonRootCA4.pem \
https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem; do
@actionjack
actionjack / killAllBuilds.groovy
Created March 16, 2022 15:38 — forked from brandonfl/killAllBuilds.groovy
Kill all build and remove queued ones
import java.util.ArrayList;
import hudson.model.*;
def q = Jenkins.instance.queue
for (queued in Jenkins.instance.queue.items) {
q.cancel(queued.task)
}
for (job in Jenkins.instance.items) {
stopJobs(job)
@actionjack
actionjack / how-to-git-patch-diff.md
Created March 9, 2022 09:49 — forked from nepsilon/how-to-git-patch-diff.md
How to generate and apply patches with git? — First published in fullweb.io issue #33

How to generate and apply patches with git?

It sometimes happen you need change code on a machine from which you cannot push to the repo. You’re ready to copy/paste what diff outputs to your local working copy.

You think there must be a better way to proceed and you’re right. It’s a simple 2 steps process:

1. Generate the patch:

git diff &gt; some-changes.patch
@actionjack
actionjack / Jenkinsfile.groovy
Created February 21, 2022 09:47 — forked from Faheetah/Jenkinsfile.groovy
Jenkinsfile idiosynchrasies with escaping and quotes
node {
echo 'Results included as an inline comment exactly how they are returned as of Jenkins 2.121, with $BUILD_NUMBER = 1'
echo 'No quotes, pipeline command in single quotes'
sh 'echo $BUILD_NUMBER' // 1
echo 'Double quotes are silently dropped'
sh 'echo "$BUILD_NUMBER"' // 1
echo 'Even escaped with a single backslash they are dropped'
sh 'echo \"$BUILD_NUMBER\"' // 1
echo 'Using two backslashes, the quotes are preserved'
sh 'echo \\"$BUILD_NUMBER\\"' // "1"