Skip to content

Instantly share code, notes, and snippets.

@jimklimov
jimklimov / swap-noauto
Last active Nov 2, 2022
/etc/init.d/swap-noauto for Linux
View swap-noauto
#!/bin/sh
### /etc/init.d/swap-noauto for Linux
### Copyright (C) 2020-2022 by Jim Klimov
### Partially based on https://unix.stackexchange.com/a/594006
### and https://wiki.archlinux.org/index.php/ZFS#Swap_volume
### BEGIN INIT INFO
# Provides: swap
# Required-Start: $local_fs
@jimklimov
jimklimov / JimKlimov-opensource.txt
Last active Oct 17, 2022
Jim Klimov on the Open Source way
View JimKlimov-opensource.txt
Originally posted at https://github.com/jenkins-infra/jenkins.io/pull/5537#issuecomment-1272498645
Cheers @jmMeessen - I suppose we've met on some of the FOSDEMs so you might have some answers already, but I understand this is a neat questionnaire anyway :) Feel free to arrange and share:
> This is why I am reaching out to you to better get to know you as a community member and a contributor. Would you mind to answer the following questions?
Sure, but in a bit of a different order for a better narrative :)
> * Who are you? Where are you located? What do you do for a living?
@jimklimov
jimklimov / S99dns
Created Sep 12, 2022
Fix for WSL2 lacks internet DNS
View S99dns
#!/bin/sh
# Add as /etc/rc3.d/S99dns
if grep -q -E '^nameserver 8.8.8.8' /etc/resolv.conf ; then exit 0 ; fi
if [ "$1" = start ]; then
mkdir -p /run/resolvconf/ && echo 'nameserver 8.8.8.8' >> /etc/resolv.conf
fi
View gist:5af9918d39155ee6724faf17d71a2d94
fetch = +refs/pull/1027/head:refs/remotes/origin/PR-1027
@jimklimov
jimklimov / Jenkinsfile
Created Nov 8, 2021 — forked from oifland/Jenkinsfile
Loops in Jenkinsfiles
View Jenkinsfile
// Related to https://issues.jenkins-ci.org/browse/JENKINS-26481
abcs = ['a', 'b', 'c']
node('master') {
stage('Test 1: loop of echo statements') {
echo_all(abcs)
}
stage('Test 2: loop of sh commands') {
View gist:1f8ffd87b09bcfdcefeda7848cf9aced
  • Linux /etc/init.d/virtualbox-hdd-timeout:
#!/bin/sh

### BEGIN INIT INFO
# Provides:          hdd-timeout
# Required-Start:    
# Required-Stop:     
# Should-Start:      
# Should-Stop: 
@jimklimov
jimklimov / icc
Last active Oct 4, 2021
Intel CC on Linux
View icc
Earlier "icc" emulated "gcc"; nowadays it is a "clang"
* wget from intel site https://software.intel.com/content/www/us/en/develop/tools/oneapi/base-toolkit/download.html?operatingsystem=linux
* run the shell installer (may need to `export TERM=vt100` in console mode)
* use wrapper script below as /usr/bin/icc (symlinks as i++ and icc-cpp, maybe suffixed with version from path component e.g. icc-2021.3.0)
----
# copy-paste the file as /usr/bin/icc
chmod +x /usr/bin/icc
( cd /usr/bin && for I in i++ icc-cpp icc-cpp-2021.3.0 icc-2021.3.0 i++-2021.3.0 ; do ln -s icc $I ; done )
----
@jimklimov
jimklimov / gist:51bffb26073ee3c6493c6f908b6afa79
Created Sep 12, 2021
Jenkins log parser - strip escaped links, leave plaintext
View gist:51bffb26073ee3c6493c6f908b6afa79
sed -e 's,.\[8mha://.*.\[0m,,' < log > %D/1089-log
@jimklimov
jimklimov / gist:28e480a635c8de2d0cdf2250a4277c4f
Last active Nov 7, 2022
Jenkins/groovy scripting ideas from hichhiker @IRC
View gist:28e480a635c8de2d0cdf2250a4277c4f

= Self-wrapping code()

I have my own version of "declarative" we use, and in that case you can add parameters like timestamps: true so I have code roughly (see below) like:

def workflow = { // stuff to do }
if (config.timestamps){
    //*******NEEDED *****//
    def inner = workflow()
    //********************//
 workflow = { timestamps { inner() } }
View gist:b92a4fe5bb8eab70e79d6f1581563863
Installing prereqs on OpenIndiana for maximum build
Achievable setup and result:
./configure --with-all --with-dev --with-doc=auto --without-modbus
gmake all -j8
gmake check
Prereqs:
pkg install gnu-make automake autoconf \