Skip to content

Instantly share code, notes, and snippets.

View cybergavin's full-sized avatar

cybergavin cybergavin

View GitHub Profile
@cybergavin
cybergavin / curl-from-gitlab.txt
Created January 24, 2021 03:09
Curl content from gitllab repo
# Find Project ID
# To get raw content of file build/setup.py in private project with Project ID 32
# Generate Personal access token with "read_repository" privilege
curl -LJO --header "PRIVATE-TOKEN: <token_value>" https://git.test.ca/api/v4/projects/32/repository/files/build%2Fsetup.py/raw?ref=master
# If the project is public
curl -LJO https://git.test.ca/api/v4/projects/32/repository/files/build%2Fsetup.py/raw?ref=master
@cybergavin
cybergavin / gitlab-ce_UI_Cert.md
Last active February 15, 2021 19:41
gitlab-ce UI Cert
  • Upload new key - /etc/gitlab/ssl/gitlab.key

  • Upload new cert - /etc/gitlab/ssl/gitlab.crt

  • Update the following section in /etc/gitlab/gitlab.rb

    nginx['ssl_certificate'] = "/etc/gitlab/ssl/gitlab.crt"
    nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/gitlab.key"
    
  • Reload config for nginx

sudo gitlab-ctl hup nginx

@cybergavin
cybergavin / gitlab-ce_upgrade.md
Last active February 15, 2021 19:42
gitlab-ce Upgrades
  • Upgraded GitLab (on RHEL 7) from v11.1.4 to v13.8.0

  • Refer upgrade paths at https://docs.gitlab.com/ee/update/

      11.1.4 --> 11.11.8 --> 12.0.12 --> 12.1.17 --> 12.10.14 --> 13.0.14 --> 13.8.0
    
  • Install gitlab-ce repos

      curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash
    
  • For each upgrade path

@cybergavin
cybergavin / ovs-commands.sh
Created January 13, 2021 02:25
Open vSwitch Useful Commands
# Get OVS version
root#> ovs-vsctl -V
ovs-vsctl (Open vSwitch) 2.5.10
Compiled Oct 5 2020 18:07:51
DB Schema 7.12.1
# List OVS Bridges
root#> ovs-vsctl list-br
br.dmx
br.microseg
@cybergavin
cybergavin / GetScriptDir
Last active January 30, 2021 20:26
Get Current Script Directory
#
# Get the location of a script irrespective of how it's called (sourced or new shell) or
# where it's called from (absolute or relative paths).
#
##########################################################################################
# BASH
scriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# PYTHON
from pathlib import *
@cybergavin
cybergavin / NCC-checks.txt
Last active December 18, 2020 05:03
Nutanix Cluster Checks
Ensure PING is enabled from CVMs/AHVs to all services (DNS/AD/NTP) as NCC uses ping first!
ncc health_checks
+---------------------------------------------------------------------------------------------------------+
| Type | Name | Impact | Short help |
+---------------------------------------------------------------------------------------------------------+
| M | anomaly_checks | N/A | Anomaly checks |
| M | cassandra_checks | N/A | Cassandra related checks |
| M | cerebro_stats | N/A | Various cerebro stats collectors. |
| M | data_protection_checks | N/A | Data Protection related checks |
@cybergavin
cybergavin / ADCS-SwitchHash.txt
Last active December 17, 2020 15:51
Switch Hashing Algorithm on AD CS CA
# Switch Hashing Algorithm on Issuing and Root CAs
certutil -setreg ca\csp\CNGHashAlgorithm SHA256
net stop certsvc
net start certsvc
# Renew Issuing CA
@cybergavin
cybergavin / ntnx-cvm-memreduce.txt
Last active December 15, 2020 05:13
Nutanix CVM Memory reduction
# Reduce a CVM's memory from 24GB to 20GB
###########################################################################
[root@ahv01 ~]# virsh list --all
Id Name State
----------------------------------------------------
2 NTNX-ahv01-CVM running
############################################################################
[root@ahv01 ~]# virsh dominfo NTNX-ahv01-CVM
Id: 2
@cybergavin
cybergavin / ipv6-barrier.txt
Created December 8, 2020 01:23
Keyboard and mouse sharing via barrier over ipv6
# Barrier client on Manjaro Linux
cybergavin> ip -6 addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
inet6 fe80::4be8:842b:6d73:8992/64 scope link noprefixroute
valid_lft forever preferred_lft forever
cybergavin> telnet fe80::d478:413a:45f4:f96e%wlp4s0 24800
@cybergavin
cybergavin / scpFetch.ps1
Created November 16, 2020 04:01
SCP files from remote host
# ---------------------------------------------------------------------
# SCP files from remote host
# ---------------------------------------------------------------------
#
# Variables
#
$myHost=$env:COMPUTERNAME
$scriptPath=[string] ($MyInvocation.MyCommand.Definition)
$rootDir="$($scriptPath.substring(0,$scriptPath.LastIndexOf('\')))"
$scpKey="${rootDir}\id_rsa"