Skip to content

Instantly share code, notes, and snippets.

@cowlinator
cowlinator / jenkins_casc.yaml
Last active June 10, 2024 20:56
jenkins configuration as code seed job from github enterprise
jobs:
- script: >
multibranchPipelineJob('jenkins-casc-seed') {
def repo = "https://my-github-server/..."
branchSources {
github {
// The id option in the Git and GitHub branch source contexts is now mandatory (JENKINS-43693).
id(UUID.nameUUIDFromBytes(repo.getBytes()).toString()) // IMPORTANT: use a constant and unique identifier
scanCredentialsId('github')
repoOwner('my-org')
@cowlinator
cowlinator / Write-lock_file_(Windows)
Last active June 10, 2024 20:54
Write-lock file (Windows)
( >&2 pause ) >> yourfile.txt
@cowlinator
cowlinator / Jenkinsfile
Last active June 10, 2024 20:47
jenk hasVariable (keep me)
pipeline {
agent none
stages {
stage('stage') {
steps {
script {
if (binding.hasVariable('superVariable')) {
echo("superVariable == 0: ")
echo(superVariable == 0)
}
@cowlinator
cowlinator / gain_and_bias.txt
Created July 8, 2023 02:51
gain_and_bias.txt
gain == weight == amplitude == strength
bias == phase == offset == shift
@cowlinator
cowlinator / paramiko_hello_world.py
Last active March 12, 2022 01:00
Paramiko SFTP Hello World
import paramiko
def get(host, user, passw, remote_path, local_path, public_host_key_filepath=None):
with paramiko.SSHClient() as ssh:
if public_host_key_filepath:
# secure
ssh.load_host_keys(public_host_key_filepath)
ssh.set_missing_host_key_policy(paramiko.RejectPolicy())
else:
# not secure
@cowlinator
cowlinator / pathlib_interface.txt
Created February 12, 2020 02:49
pathlib_interface.txt
class _Flavour(object):
"""A flavour implements a particular (platform-specific) set of path
semantics."""
def __init__(self)
def parse_parts(self, parts)
def join_parsed_parts(self, drv, root, parts, drv2, root2, parts2)
"""
Join the two paths represented by the respective
(drive, root, parts) tuples. Return a new (drive, root, parts) tuple.
"""
@cowlinator
cowlinator / docker msbuild fix
Created March 13, 2019 01:34
How to fix msbuild LNK1318 in Docker containers without modifying the project files
Create a file with the following contents:
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Fix for error LNK1318 in hyperV docker containers -->
<ItemDefinitionGroup>
<ClCompile>
<DebugInformationFormat>OldStyle</DebugInformationFormat>
</ClCompile>
</ItemDefinitionGroup>
@cowlinator
cowlinator / git_commands.txt
Last active October 3, 2017 01:36
Useful git commands
git checkout -- . DISCARD non-staged changes
git clean -d -f DISCARD untracked files
git cherry-pick --no-commit $SHA Cherry-pick to staging area
git revert --no-commit $SHA Revert to staging area
git push -f FORCE push
git reset --hard @{u} RESET HARD to upstream-branch
git branch --unset-upstream Track Remote: None (for current branch)
git branch --set-upstream-to=$REMOTE_BRANCH Track Remote (for current branch)