Skip to content

Instantly share code, notes, and snippets.

View odyssey4me's full-sized avatar

Jesse Pretorius odyssey4me

  • Red Hat
  • United Kingdom
View GitHub Profile
@odyssey4me
odyssey4me / set-mtu-windows.rst
Created September 8, 2015 09:58
Setting MTU size in Windows

Introduction

Due to the underlying networking services making use of tunnelling and packet tagging a situation may arise where instance network connectivity, especially when downloading large files or transferring files, is found to be unreliable.

This article describes how to adjust the instance to ensure that it uses a suitable MTU size so that packets are not dropped by the underlying infrastructure.

Note that the appropriate MTU size is delivered via DHCP by the underlying network service, but not all operating systems make use of the DHCP option to dynamically set the MTU size for the NIC. This document thus serves as a failback when then DHCP option is not used.

Symptoms

@odyssey4me
odyssey4me / opendevin-install.ps1
Last active April 3, 2024 19:38
OpenDevin on Windows 11 - this no longer works!
#
# Unfortunately, this does not work due to python libraries that do not support windows natively.
# Use a WSL VM instead!
#
# ref: https://github.com/OpenDevin/OpenDevin
# This must all be done from a Powershell Prompt run as Administrator
# install chocolatey (for ease of installing packages)
# https://docs.chocolatey.org/en-us/choco/setup
@odyssey4me
odyssey4me / gist:3ce1b4f08bf8ceb34b93590c11d1f91a
Last active December 22, 2023 17:51
Mac OS X: working around brew failing to install a cask due to a protected file in /usr/local/lib/
If you see an error like this:
% brew install macfuse
==> Caveats
macfuse requires a kernel extension to work.
If the installation fails, retry after you enable it in:
System Preferences → Security & Privacy → General
For more information, refer to vendor documentation or this Apple Technical Note:
https://developer.apple.com/library/content/technotes/tn2459/_index.html
@odyssey4me
odyssey4me / lvm-cache-fedora.md
Created June 19, 2023 10:23 — forked from gabrieljcs/lvm-cache-fedora.md
Instructions to create an LVM cache for root in Fedora

LVM cache in Fedora

From the man-pages: "The cache logical volume type uses a small and fast LV to improve the performance of a large and slow LV. It does this by storing the frequently used blocks on the faster LV. LVM refers to the small fast LV as a cache pool LV. The large slow LV is called the origin LV. Due to requirements from dm-cache (the kernel driver), LVM further splits the cache pool LV into two devices - the cache data LV and cache metadata LV. The cache data LV is where copies of data blocks are kept from the origin LV to increase speed. The cache metadata LV holds the accounting information that specifies where data blocks are stored (e.g. on the origin LV or on the cache data LV). Users should be familiar with these LVs if they wish to create the best and most robust cached logical volumes. All of these associated LVs must be in the same VG."

Assuming LVM is already setup in HDD (e.g. from anaconda) and SSD is untouched.

Create a physical

@odyssey4me
odyssey4me / 0-rsync.log
Last active May 28, 2022 13:48
Working with rsync and chown, with rsync and with Ansible's synchronize module. Playbook 1 only works for Ansible<2.3 and Playbook 2 works for Ansible 2.3+. The subtle difference was discovered in https://github.com/ansible/ansible/issues/23575 - for Ansible 2.3+ DO NOT QUOTE the rsync_opts.
root@foo:~# rm -rf test; mkdir test; touch test/test{1,2,3}; chown ubuntu test/test1; chown aptly test/test2; ls -al test/
total 8
drwxr-xr-x 2 root root 4096 Nov 30 10:47 .
drwx------ 11 root root 4096 Nov 30 10:47 ..
-rw-r--r-- 1 ubuntu root 0 Nov 30 10:47 test1
-rw-r--r-- 1 aptly root 0 Nov 30 10:47 test2
-rw-r--r-- 1 root root 0 Nov 30 10:47 test3
root@foo:~# rsync -avz --chown 'nginx:www-data' -e "ssh -i ~/.ssh/my.key" --verbose test root@bar:/tmp/
opening connection using: ssh -i "~/.ssh/my.key" -l root bar rsync --server -vvlogDtprze.iLsfx "--usermap=*:nginx" "--groupmap=*:www-data" . /tmp/ (13 args)
@odyssey4me
odyssey4me / gateparse.py
Last active January 8, 2022 17:08
OpenStack-Ansible Gate console.html analyzer - thanks to Logan Vig/Jimmy McRory for this!
#!/usr/bin/env python
import argparse
import json
import re
import sys
import yaml
from datetime import datetime
from datetime import timedelta
---
# Final published location: https://access.redhat.com/solutions/4067471
- name: Rename network interfaces
hosts: all
become: true
vars:
src_prefix: "eth"
dst_prefix: "em"
osnet_conf: "/etc/os-net-config/config.json"
src_interfaces: "{{ ansible_interfaces | select('match', src_prefix ~ '.*') | sort | list }}"
@odyssey4me
odyssey4me / attribute-map.xml
Last active September 23, 2021 16:44
Working Shibboleth-based Keystone SP for ADFS IdP
<Attributes xmlns="urn:mace:shibboleth:2.0:attribute-map" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Attribute name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn" id="upn"/>
<Attribute name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname" id="givenname"/>
<Attribute name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname" id="surname"/>
<Attribute name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress" id="emailaddress"/>
<Attribute name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" id="name"/>
<Attribute name="http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid" id="primarysid"/>
<Attribute name="http://schemas.xmlsoap.org/claims/Group" id="Group"/>
@odyssey4me
odyssey4me / devpi.sh
Last active April 22, 2021 15:37
Exploring various pypi repo/cache options
# http://doc.devpi.net/latest/
# Basic host package set
apt-get update && \
apt-get purge -y nano && \
apt-get install -y git vim tmux fail2ban
# Install packages
apt-get install -y python-pip gcc git-core libssl-dev libffi-dev python-pyasn1 python-openssl python-ndg-httpsclient gzip python-dev lsb-release python-virtualenv
pip install devpi-server devpi-web devpi-client
@odyssey4me
odyssey4me / 0-setup.sh
Last active April 14, 2021 03:36
Poor man's frozen apt mirror - it still needs work to do an auto clean based on files not referenced
apt-get update
apt-get purge -y nano
apt-get install -y vim tmux fail2ban nginx apt-mirror lxc
# change nginx config:
# /etc/nginx/sites-enabled/default
systemctl restart nginx
# change apt-mirror config:
# /etc/apt/mirror.list