Skip to content

Instantly share code, notes, and snippets.

View samueljon's full-sized avatar

Samúel Jón Gunnarsson samueljon

View GitHub Profile
@samueljon
samueljon / toggleHT.sh
Last active August 18, 2023 20:05
Disable / Enable HyperThreading cores on runtime - linux
#!/bin/bash
HYPERTHREADING=1
function toggleHyperThreading() {
for CPU in /sys/devices/system/cpu/cpu[0-9]*; do
CPUID=`basename $CPU | cut -b4-`
echo -en "CPU: $CPUID\t"
[ -e $CPU/online ] && echo "1" > $CPU/online
THREAD1=`cat $CPU/topology/thread_siblings_list | cut -f1 -d,`
@samueljon
samueljon / ldap_debug_1.php
Created March 14, 2017 13:21
For debugging Ldap connectivity issues in php
<?php
// Set the ldap server
$ldapurl = "host.domain.tld";
$ldapuser = "user@domain.tld";
$ldappass = 'userpassword';
// Set the debug flag
$debug = true;
// Set debugging
@samueljon
samueljon / cilium.yaml
Created March 21, 2022 21:23
testing deployment of Cilium v1.11.2 in a talos based cluster.
---
# Source: cilium/templates/cilium-agent/serviceaccount.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: "cilium"
namespace: kube-system
---
# Source: cilium/templates/cilium-operator/serviceaccount.yaml
apiVersion: v1
@samueljon
samueljon / tweak_6rd.rsc
Created December 26, 2021 14:35 — forked from olafz/tweak_6rd.rsc
Tweak IPv6 mikrotik RouterOS (6RD)
# Dutch ISP Tweak offers IPv6 via 6rd. The commands below configure a mikrotik
# RouterOS with 6rd. This was tested with RouterOS 6.46.1.
#
# First, you'll have to request IPv6 information from Tweak. You'll receive
# a fixed IPv4 address and some other information. For the rest of this guide,
# I assume the following information is received from Tweak:
#
# ===
# IPv4 address: 185.227.123.123
# IPv4 mask length: 22
#!/bin/bash
#########################################################
# Script Name : ansible_onboarding.sh
# Description : Adds Ansible user and sudo permissions.
# Args : none
# Author : Samúel Jón Gunnarsson
# Email : samuel@ok.is
# Version : 20200923-01
########################################################
---
# tasks file for xrd-ansible-onboard
- name: Ansible onboarding
vmware_vm_shell:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
validate_certs: no
datacenter: "{{ datacenter }}"
folder: "{{ vcenter_folder }}"
---
- name: Clone a virtual machine from Linux template
vmware_guest:
hostname: "{{ vcenter_hostname }}"
username: "{{ vcenter_username }}"
password: "{{ vcenter_password }}"
resource_pool: ansible-resource-pool
validate_certs: no
datacenter: "{{ datacenter }}"
state: poweredon
@samueljon
samueljon / force-mcp-ocp-update
Created August 21, 2021 13:50 — forked from ikurni/force-mcp-ocp-update
How to force openshift MCP to update machine config
### Create file called machine-config-daemon-force in /run ###
ssh core@hostname.local sudo touch /run/machine-config-daemon-force
### Edit node annotations ###
oc edit node <node-name>
### Check Annotations, change like below sample ###
machineconfiguration.openshift.io/currentConfig: rendered-worker-ab4a1e7216bf3da2a5203f09c871b456
machineconfiguration.openshift.io/desiredConfig: rendered-worker-ab4a1e7216bf3da2a5203f09c871b456
machineconfiguration.openshift.io/reason: ""
@samueljon
samueljon / configuration.yaml
Last active November 29, 2020 15:41
Sensor sem sækir gengi frá M5 og birtir í Home Assistant sem m5_is_rate_GJALDMIDILL
#####################
# Sensors
#####################
sensor:
- platform: rest
name: apis_currency_m5
resource: https://apis.is/currency/m5
scan_interval: 60
json_attributes:
- results
@samueljon
samueljon / keepass_install.sh
Last active July 15, 2020 10:20
Install wine + dotnet on osx via brew
#!/bin/bash
brew install wine-stable winetricks
WINEARCH=win32 WINEPREFIX=~/.wine winecfg
mkdir ~/.cache/winetricks/
winetricks -q dotnet45 corefonts