Skip to content

Instantly share code, notes, and snippets.

View lewars's full-sized avatar

Alistair Y. Lewars lewars

  • New Jersey
  • 18:55 (UTC -04:00)
View GitHub Profile
import jenkins.model.Jenkins
import hudson.model.Job
def jenkins = Jenkins.instance
def totalJobs = 0
def enabledCount = 0
// Compatibility:
// Jenkins: 2.516.3
import jenkins.model.Jenkins
import hudson.model.Job
import hudson.model.Queue
// --- WARNING ---
// This script performs destructive actions (clearing the queue) and
// modifies all job configurations (disabling them). Run with caution.
// Compatible with Jenkins 2.516.3
# Loop using matrix
build-all:
desc: Build for all supported platforms (linux, darwin, windows on amd64/arm64)
deps: [clean, build]
cmds:
- mkdir -p {{.BUILD_DIR}}
- for:
matrix:
OS: [ 'windows', 'linux', 'darwin',]
ARCH: ['amd64', 'arm64']
[
// Emacs-style "kill" from the cursor to the end of the line
{
"key": "ctrl+k",
"command": "editor.action.clipboardCutAction",
"when": "editorTextFocus && !editorHasSelection && !editorReadonly"
},
// Emacs-style "yank" (paste)
{
"key": "ctrl+y",
@lewars
lewars / get_diskgeo.c
Created April 21, 2025 01:37
Get disk storage geometry using ioctl() system call
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/hdreg.h> // For HDIO_GETGEO
int main(int argc, char *argv[]) {
if (argc != 2) {
fprintf(stderr, "Usage: %s <device_path>\n", argv[0]);
return 1;

Linux Command Reference

Navigating Directories

cd <directory_name>  # Change to the specified directory
cd ..               # Move up one directory
cd ~                # Go to the home directory

Listing Directories

@lewars
lewars / create.yml
Created March 22, 2025 22:45
Ansible pattern on provisioning cloud init VMs using Molecule and qemu-kvm for testing
---
- name: Create VM
hosts: localhost
connection: local
gather_facts: false
vars:
molecule_yml: "{{ lookup('file', lookup('env', 'MOLECULE_FILE')) | from_yaml }}"
molecule_instance_config: "{{ lookup('env', 'MOLECULE_INSTANCE_CONFIG') }}"
vm_name: "{{ molecule_yml.platforms[0].name }}"
vm_path: "/tmp/{{ vm_name }}.qcow2"
@lewars
lewars / docker-mount-volumes.md
Created January 16, 2025 12:39
Docker Mounting Volumes: Bind Mount
@Library('pplus_std_lib') _
@Library('pplus_stages_lib@v1.0') _
@Library('pplus_meta_lib@v1.0') _
@Library('pplus_security_lib@v1.0') _
AppMeta appMeta
pipeline {
// [...]
stages {
stage('Preparation') {