Skip to content

Instantly share code, notes, and snippets.

View O5ten's full-sized avatar

Mikael Östberg O5ten

View GitHub Profile
$ mend iac
Initializing: Done
Scanning: Done
[Retrieving: IaC misconfigurations] ◢
Scanned to Organization: Aurora Innovation Unified Platform | Application: My IAC Application, Project: iac
Detected 18 Misconfigurations (CRITICAL: 0, HIGH: 0, MEDIUM: 4, LOW: 14, UNKNOWN: 0)
+----------+------------+---------+----------+----------------------+----------------------+------------+----------+
| FILE | PROVIDER | SERVICE | SEVERITY | DETAILS | RESOLUTION | START LINE | END LINE |
+----------+------------+---------+----------+----------------------+----------------------+------------+----------+
11:55 $ snyk container test nginx:stable-bullseye --severity-threshold=critical
Testing nginx:stable-bullseye...
✗ Critical severity vulnerability found in zlib/zlib1g
Description: Integer Overflow or Wraparound
Info: https://security.snyk.io/vuln/SNYK-DEBIAN11-ZLIB-6008961
Introduced through: zlib/zlib1g@1:1.2.11.dfsg-2+deb11u2
From: zlib/zlib1g@1:1.2.11.dfsg-2+deb11u2
@O5ten
O5ten / readonlybot.js
Last active April 14, 2023 08:05
Mattermost-readonly-apps-script
/**
* A simple Google Apps Script that makes a channel "read-only" by
* intercepting all messages and removing them if a user isn't in the allowedUsers list
* latest version here: https://gist.github.com/O5ten/830d6939bd6194501d36df3b2fcc7972
*/
const token = '<TOKEN>'; //Bot token
const mattermostUrl = '<Mattermost-URL>';
const allowedUsers = ['<username>']
const getOptions = {
'method': 'get',
~/git/backstage$ yarn clean && yarn install
yarn run v1.22.1
$ backstage-cli clean && lerna run clean
lerna notice cli v3.22.1
lerna info Executing command in 56 packages: "yarn run clean"
lerna WARN ECYCLE Dependency cycles detected, you should fix these!
lerna WARN ECYCLE @backstage/backend-common -> @backstage/cli -> @backstage/backend-common
lerna WARN ECYCLE @backstage/core-api -> (nested cycle: @backstage/backend-common -> @backstage/cli -> @backstage/backend-common) -> @backstage/core -> @backstage/core-api
lerna WARN ECYCLE @backstage/dev-utils -> @backstage/test-utils -> (nested cycle: @backstage/core-api -> (nested cycle: @backstage/backend-common -> @backstage/cli -> @backstage/backend-common) -> @backstage/core -> @backstage/core-api) -> @backstage/dev-utils
lerna WARN ECYCLE @backstage/integration -> (nested cycle: @backstage/dev-utils -> @backstage/test-utils -> (nested cycle: @backstage/core-api -> (nested cycle: @backstage/backend-common -> @backstage/cli -> @backstage/backend-common) -> @back
def pass = [
"| Övning | Vikt |\\n| ---------- | :-------------: |\\n| Marklyft | 3 set x 6–8 reps |\\n| chins | 3 set x 8–10 reps |\\n| Militärpress | 3 set x 8–10 reps |",
"| Övning | Vikt |\\n| ---------- | :-------------: |\\n| Knäböj | 3 set x 8–10 reps |\\n| Bänkpress | 3 set x 8–10 reps |\\n| Chins | 3 set x 8–10 reps |"
]
def message = pass[(env.BUILD_ID as Integer) % pass.size()]
pipeline {
Started by user Mikael Östberg
Obtained Jenkinsfile from git https://github.com/O5ten/kickass-recipes.git
Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] node
Running on Jenkins in /var/lib/jenkins/workspace/gustav/kickass
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Declarative: Checkout SCM)
[Pipeline] checkout
@O5ten
O5ten / Jenkinsfile
Last active June 16, 2019 19:14
Example jenkinsfile to test some arbitrary output in the log
pipeline {
parameters {
string(name: 'stuffToCheck', defaultValue: 'Test Failure!,Some Other Failure!', desription: 'CSV of stuff to check in the build-log')
}
stages {
stage('The thing'){
steps {
echo 'Test Failure!'
echo 'Some Other Failure!'
}
@O5ten
O5ten / Jenkinsfile
Last active February 15, 2019 21:15
Jenkins pipeline
pipeline {
agent 'linux'
stages {
stage('Build ') {
steps {
sh 'mvn compile'
}
}
stage('Run Tests') {
steps {
@O5ten
O5ten / clearSandbox.groovy
Created September 18, 2018 14:22
Clear Jenkins Sandbox Folder from jobs
import hudson.model.*
def isFolder = { it.class.canonicalName == 'com.cloudbees.hudson.plugins.folder.Folder' }
def isSandbox = { "sandbox" == it.fullName }
def deleteChildren = {
it.getItems().collect { item ->
def deletedName = item.fullName
item.delete()
"${deletedName} deleted"
@O5ten
O5ten / folderIconModificator.js
Created September 15, 2018 21:55
Jenkins Folder Icon Modificator
//Put in $JENKINS_HOME/userContent/FolderIconModificator.js
//Using the Simple Theme Plugin you then add /userContent/FolderIconModificator.js as a JavaScript URL
(function(){
setTimeout(function(){
jQuery('.job-status-').map(function(i, job){
return job.id;
}.bind(this)).each(function(i, imageUrl){
jQuery.ajax({
type: "HEAD",
async: true,