Skip to content

Instantly share code, notes, and snippets.

View salanisor's full-sized avatar

Saul Alanis salanisor

  • Linux Kernel
View GitHub Profile
@salanisor
salanisor / resize_disk_image.md
Created April 3, 2025 23:33 — forked from joseluisq/resize_disk_image.md
How to resize a qcow2 disk image on Linux

How to resize a qcow2 disk image on Linux

This example takes olddisk.qcow2 and resizes it into newdisk.qcow2, extending one of the guest's partitions to fill the extra space.

1. qcow2 format

1.1. Verify the filesystems of olddisk.qcow2

@salanisor
salanisor / config
Created October 6, 2024 20:26 — forked from rbialek/config
ssh/.config
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile /home/user/.ssh/id_rsa
@salanisor
salanisor / custom-machine-set
Created September 6, 2024 21:53 — forked from tosin2013/custom-machine-set
Custom Machine Set for OpenShift
#!/bin/bash
set -xe
curl -OL https://github.com/openshift/openshift-cns-testdrive/raw/ocp4-dev/support/machineset-cli
curl -OL https://raw.githubusercontent.com/openshift/openshift-cns-testdrive/ocp4-dev/support/machineset-generator.sh
chmod +x machineset-generator.sh
chmod +x machineset-cli
bash /home/lab-user/machineset-generator.sh 1 infra 0 | oc create -f -
export MACHINESET=$(oc get machineset -n openshift-machine-api -l machine.openshift.io/cluster-api-machine-role=infra -o jsonpath='{.items[0].metadata.name}')
oc patch machineset $MACHINESET -n openshift-machine-api --type='json' -p='[{"op": "add", "path": "/spec/template/spec/metadata/labels", "value":{"node-role.kubernetes.io/worker":"", "node-role.kubernetes.io/infra":""} }]'
@salanisor
salanisor / A Readme for Adding Certs.md
Created March 11, 2024 21:12 — forked from Artistan/A Readme for Adding Certs.md
Add new certificate (cert) from local/internal intranet to your mac

Add a cert to you macbook

USAGE

~/add_cert.sh my.intra.net

you will be asked for your password to add thit to keychain

  • downloads pem file
  • adds to trusted root certificates
@salanisor
salanisor / checkoutcode
Created October 16, 2023 16:51 — forked from davidyang013/checkoutcode
GitPython Library clone code from remote and switch branch
import git,os,shutil
def get_branch(url,path,branch):
if url == None or path == None:
raise ValueError("Please assign right URL and Path")
else:
if os.path.isdir(path):
shutil.rmtree(path)
os.mkdir(path)
repo = git.Repo.clone_from(url, path, progress=None)
@salanisor
salanisor / ansible-git.md
Created October 16, 2023 16:44 — forked from sivel/ansible-git.md
Ansible Contributors Guide for working with git/GitHub

Ansible Contributors Guide for working with git/GitHub

First Note

Never, ever, modify or commit things to devel, always do work in a feature branch

Setting up the ansible and modules repos from forks

export GITHUB_USER=sivel
@salanisor
salanisor / force-mcp-ocp-update
Created September 19, 2023 01:40 — forked from ikurni/force-mcp-ocp-update
How to force openshift MCP to update machine config
### Create file called machine-config-daemon-force in /run ###
ssh [email protected] sudo touch /run/machine-config-daemon-force
### Edit node annotations ###
oc edit node <node-name>
### Check Annotations, change like below sample ###
machineconfiguration.openshift.io/currentConfig: rendered-worker-ab4a1e7216bf3da2a5203f09c871b456
machineconfiguration.openshift.io/desiredConfig: rendered-worker-ab4a1e7216bf3da2a5203f09c871b456
machineconfiguration.openshift.io/reason: ""
@salanisor
salanisor / main.tf
Created March 14, 2023 19:05 — forked from brikis98/main.tf
A hacky way to create a dynamic list of maps in Terraform
# The goal: create a list of maps of subnet mappings so we don't have to statically hard-code them in aws_lb
# https://www.terraform.io/docs/providers/aws/r/lb.html#subnet_mapping
locals {
# These represent dynamic data we fetch from somewhere, such as subnet IDs and EIPs from a VPC module
subnet_ids = ["subnet-1", "subnet-2", "subnet-3"]
eips = ["eip-1", "eip-2", "eip-3"]
}
# Here's the hack! The null_resource has a map called triggers that we can set to arbitrary values.
# We can also use count to create a list of null_resources. By accessing the triggers map inside of
@salanisor
salanisor / terraform.tf
Created March 14, 2023 19:00 — forked from jcbagtas/terraform.tf
Merge a variable List of Maps in Terraform 0.12
# This gist mimics the supposed behavior of
# variable = merge(someListOfMaps[*].parameters...)
# or
# policy_parameters = merge(data.azurerm_policy_definition.d_policy_definitions[*].parameters...)
locals {
policy_parameters = [
for key,value in data.azurerm_policy_definition.d_policy_definitions:
{
parameters = jsondecode(value.parameters)
@salanisor
salanisor / prune-pipelinerun-objects.yaml
Created February 23, 2023 20:27 — forked from chmouel/prune-pipelinerun-objects.yaml
cronjob for pruning pipelinerun objects by age
apiVersion: v1
kind: List
items:
- apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: pr-cleanup
namespace: ghe
spec:
concurrencyPolicy: Replace