Skip to content

Instantly share code, notes, and snippets.

View jostmart's full-sized avatar

jostmart

View GitHub Profile

Keybase proof

I hereby claim:

  • I am jostmart on github.
  • I am jostmart (https://keybase.io/jostmart) on keybase.
  • I have a public key whose fingerprint is E887 3BAB 68EF F3AC D09A 479A 4B22 8B5D CB25 2EE8

To claim this, I am signing this object:

#!/bin/bash
if [ $# -eq 0 ]; then
echo >&2 "Usage: jstackSeries <pid> <run_user> [ <count> [ <delay> ] ]"
echo >&2 " Defaults: count = 10, delay = 0.5 (seconds)"
exit 1
fi
pid=$1 # required
user=$2 # required
count=${3:-10} # defaults to 10 times
delay=${4:-30} # defaults to 30 seconds
#!/usr/bin/perl
#
# Takk Jonas :)
#
use strict;
use File::Path;
my $folder=$ARGV[0];
@jostmart
jostmart / acpi_yogaX1_fedora28
Created November 1, 2018 13:09 — forked from javanna/acpi_yogaX1_fedora28
S3 deep sleep for Lenovo yoga X1 3rd Generation on Fedora 28
This is a step-by-step guide on how make sleep mode work with a Lenovo Yoga X1 3rd generation running Fedora 28 (UEFI based system).
Kernel version: 4.17.4-200.fc28.x86_64
Credits: most of this guide comes from `https://delta-xi.net/#056`. The patch I used is a little different though, taken from http://kernel.dk/acpi.patch
(found through https://bbs.archlinux.org/viewtopic.php?pid=1794150#p1794150), and some of the steps slightly differ as well as mine is a UEFI based system.
1. Reboot, enter BIOS/UEFI. Go to Config - Thunderbolt (TM) 3 - set Thunderbolt BIOS Assist Mode to Enabled. Set also Security - Secure Boot to Disabled.
2. Install iasl (Intel's compiler/decompiler for ACPI machine language) and cpio: `sudo yum install acpica-tools cpio`
@jostmart
jostmart / 00_play.yml
Created May 30, 2019 13:53 — forked from halberom/00_play.yml
ansible - example of using selectattr to filter on attrs that are defined and true
---
- hosts: localhost
connection: local
gather_facts: False
vars:
apache2_vhosts:
- name: "stage.example.org"
docroot: "/var/www/stage1"
- name: "stage2.example.org"
docroot: "/var/www/stage2"
@jostmart
jostmart / siptrack.py
Created July 11, 2019 15:12 — forked from stemid/siptrack.py
Ansible inventory script for Siptrack (https://github.com/sii/siptrackweb)
#!/usr/bin/env python
# Siptrack dynamic inventory script for Ansible.
# Depends on siptracklib
# * https://github.com/sii/siptracklib
#
#http://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html
#
# by Stefan Midjich <swehack at gmail dot com>
@jostmart
jostmart / rancher-ha-cert-update.md
Created November 10, 2020 16:17 — forked from janeczku/rancher-ha-cert-update.md
rancher-ha-cert-update.md

Follow these steps to update the SSL certificate of the ingress in a Rancher High Availability installation or switch from the default self-signed to a custom certificate:

  1. Create or update the tls-rancher-ingress k8s secret resource with the new certificate and private key
  2. Create or update the tls-ca k8s secret resource with the root CA certificate (only required when using a private CA)
  3. Update Rancher installation using Helm CLI
  4. Reconfigure Rancher Agents to trust the new CA certificate

Detailed steps

1. Create/Update the certificate secret resource

#!/usr/bin/expect
# Set up various other variables here ($user, $password)
set user admin
set password xxxxx30r8fd
# Skapa en fil för lagring av resultat
set outfile [open ./TELNET-RESULTS.txt w]
puts $outfile "--( start )-----------------"
@jostmart
jostmart / extended-cleanup-rancher2.sh
Created May 7, 2021 11:00 — forked from superseb/extended-cleanup-rancher2.sh
Extended Rancher 2 cleanup (backup your data, use at your own risk)
#!/bin/sh
# Backup your data
# Use at your own risk
# Usage ./extended-cleanup-rancher2.sh
# Include clearing all iptables: ./extended-cleanup-rancher2.sh flush
docker rm -f $(docker ps -qa)
docker rmi -f $(docker images -q)
docker volume rm $(docker volume ls -q)
for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done
cleanupdirs="/etc/ceph /etc/cni /etc/kubernetes /opt/cni /opt/rke /run/secrets/kubernetes.io /run/calico /run/flannel /var/lib/calico /var/lib/etcd /var/lib/cni /var/lib/kubelet /var/lib/rancher/rke/log /var/log/containers /var/log/pods /var/run/calico"
@jostmart
jostmart / restore_rancher2_agents.md
Created May 7, 2021 11:01 — forked from superseb/restore_rancher2_agents.md
Restore Rancher 2 cluster/node agents on clusters

Restore Rancher 2 cluster/node agents on clusters

This is an unsupported scenario, see rancher/rancher#14731 when there is an official solution.

When cattle-cluster-agent and/or cattle-node-agent are accidentally deleted, or when server-url/cacerts are changed.

Generate definitions

  • Generate API token in the UI (user -> API & Keys) and save the Bearer token
  • Find the clusterid in the Rancher UI (format is c-xxxxx), its in the address bar when the cluster is selected