Skip to content

Instantly share code, notes, and snippets.

View martyngigg's full-sized avatar

Martyn Gigg martyngigg

View GitHub Profile
@martyngigg
martyngigg / openstack-vm.sh
Last active July 21, 2023 08:12
Very basic script to create/destroy openstack VMs
#!/usr/bin/env bash
# Control server(s) on an Openstack cloud.
# The openstack command must be available on the PATH.
#
# This script assumes a ~/.config/openstack/clouds.yaml
# exists containing credentials for the project that
# contains the servers. This can be created and downloaded
# from the Identity->Appplication Credentials section of the
# OpenStack UI.
@martyngigg
martyngigg / readme.md
Last active December 8, 2022 10:08
Windows Builder Old Method

Set Up Windows Jenkins Node (old method)

  1. Set up machine with admin permissions for your user
  2. Install C++ workload of Visual Studio 2019 Build Tools. You might need to login to microsoft with your stfc credentials to find 2019 and visit https://visualstudio.microsoft.com/vs/older-downloads/
  3. Install Git (as admin in ProgramFiles)and configure long path lenths globally:
git config --system --get core.longpaths true
  1. Set regedit key for long file paths and reboot Computer\\HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\Control\FileSystem\LongPathsEnabled (Type: REG_DWORD)
@martyngigg
martyngigg / Dockerfile.MSVC
Last active November 9, 2022 15:03
Windows docker-based Jenkins Agent for C++ Builds
# escape=`
# Use JNLP agent as base and install required tools
ARG FROM_IMAGE=jenkins/inbound-agent:4.13-2-jdk11-windowsservercore-ltsc2019
FROM ${FROM_IMAGE}
# Reset the shell.
SHELL ["cmd", "/S", "/C"]
# Set up environment to collect install errors.
@martyngigg
martyngigg / externaldata.py
Last active April 23, 2022 14:15
Tool to simlink CMake external data files on Windows
"""Tools for dealing with data registered with
CMake external data:
- Symlink from external data cache to build binary location.
Currently assumes the files have been downloaded and does not deal with
references that change.
"""
from itertools import chain
from pathlib import Path
from typing import Iterator, Sequence
@martyngigg
martyngigg / setup.md
Created April 21, 2022 16:34
Windows Containers - Docker CLI

Here are some instructions on steps to setting up Windows-based Docker containers without Docker Desktop.

Notes

  • The latest version of the docker CLI binaries can be downloaded from https://download.docker.com/win/static/stable/x86_64/
  • Download and extract the above to "C:\Program Files\Docker" for all user access
  • Activate Windows containers and HyperV. Open powershell in administrator mode:
    • Enable-WindowsOptionalFeature -Online -FeatureName containers –All
    • Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All
  • Reboot
@martyngigg
martyngigg / cheatsheat.md
Last active April 20, 2022 19:10
Windows Commands

This is a list of commands to run in the command prompt to access various windows features. They are particularly useful should you need to open a Windows feature as a different user.

Edit Environment Variables

rundll32.exe sysdm.cpl,EditEnvironmentVariables

Open Add/Remove Programs

@martyngigg
martyngigg / eofbit.cpp
Created December 8, 2021 20:15
EOF bug in libc++
#include <iostream>
#include <sstream>
int main() {
std::stringstream s;
s.exceptions(std::istream::eofbit);
s << "a";
std::cout << "EOF? " << (s.eof() ? "T" : "F") << std::endl;
@martyngigg
martyngigg / close_merged_issues.py
Last active May 19, 2022 08:48
Close issues linked to merged pull requests by milestone
"""Examines all issues assigned to a given milestone and if they are associated with
a merged pull request that is linked to fix the issue then it closes that issue.
This module exists as GitHub only closes issues linked with 'Fixes #1234' if a
pull request was merged to the default branch. During a beta period pull requests
merged to the release branch leaving dangling issues around.
Requires the pygithub module.
"""
import argparse
diff --git buildconfig/CMake/PyQtFindImpl.cmake buildconfig/CMake/PyQtFindImpl.cmake
index 3595f733df4..ca073c6b837 100644
--- buildconfig/CMake/PyQtFindImpl.cmake
+++ buildconfig/CMake/PyQtFindImpl.cmake
@@ -45,7 +45,7 @@ function (find_pyqt major_version)
set (PYQT${major_version}_VERSION_TAG "${CMAKE_MATCH_1}" CACHE STRING "The Qt version tag used by PyQt${major_version}'s .sip files" FORCE)
string (REGEX MATCH ".*\npyqt_sip_dir:([^\n]+).*$" _dummy ${_pyqt_config})
- set (PYQT${major_version}_SIP_DIR "${CMAKE_MATCH_1}" CACHE PATH "The base directory where PyQt${major_version}'s .sip files are installed" FORCE)
+ set (PYQT${major_version}_SIP_DIR "${CMAKE_MATCH_1}" CACHE PATH "The base directory where PyQt${major_version}'s .sip files are installed")
@martyngigg
martyngigg / sourceforge.md
Created August 4, 2020 13:11
Sourceforge Replacements

Soureforge Replacements

Current Speeds

Tested using home broadband. Speed measured by fast.com: 66Mbps

$ curl -L https://downloads.sourceforge.net/project/mantid/5.0/mantid-5.0.0-win64.exe\?r\=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fmantid%2Ffiles%2F5.0%2Fmantid-5.0.0-win64.exe%2Fdownload\&ts\=1596545850 -o mantid-5.0.0-win64.exe
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
 Dload Upload Total Spent Left Speed