Skip to content

Instantly share code, notes, and snippets.

View CallMeFoxie's full-sized avatar

Ashley CallMeFoxie

  • Seznam.cz
  • Czech Republic
View GitHub Profile
@CallMeFoxie
CallMeFoxie / collecthdd.sh
Last active May 17, 2022 04:24
collect server info and put it into mysql
#!/bin/bash
smartctl --scan-open -j | jq .devices[] | jq '.name+" -d "+.type' -r | grep -v scsi > /tmp/tmpfs/devices.txt
cat /tmp/tmpfs/devices.txt | while read xdevice
do
smartctl -a $xdevice -j > /tmp/tmpfs/smart.json
passed=$(cat /tmp/tmpfs/smart.json | jq .smart_status.passed -r)
poh=$(cat /tmp/tmpfs/smart.json | jq .power_on_time.hours -r)
defects=$(cat /tmp/tmpfs/smart.json | jq .scsi_grown_defect_list -r)
@CallMeFoxie
CallMeFoxie / gridcoin-metrics.sh
Created March 23, 2021 20:04
Gridcoin prometheus metrics
#!/bin/bash
difficulty=$(gridcoinresearchd getmininginfo | jq .difficulty.current)
tts=$(gridcoinresearchd getmininginfo | jq '."time-to-stake_days"')
pending=$(gridcoinresearchd getmininginfo | jq .BoincRewardPending)
blocks=$(gridcoinresearchd getmininginfo | jq .blocks)
echo "# TYPE gridcoin_network_difficulty gauge"
echo "gridcoin_network_difficulty $difficulty"
echo "# TYPE gridcoin_tts_days gauge"
dhcp
tftp 40000000 u-boot-sunxi-with-spl.bin
sf probe
sf erase 0 0x100000
sf write 0x40000000 0 0xa8b98
# replace 0xa8b98 with the downloaded size written by the tftp command
dram_para = {
/* The values are from the boot0 dump from the H6 Mini eMMC image. */
.dram_clk = 0x288,
.dram_type = 3,
.dram_zq = 0x3b3bfb,
.dram_odt_en = 1,
.dram_para1 = 0x310b,
.dram_para2 = 0x0c000000,
.dram_mr0 = 0x1a70, //0x1e14,
.dram_mr1 = 0x40,
@CallMeFoxie
CallMeFoxie / main.go
Created April 14, 2020 18:48
boinc prometheus exporter
package main
import (
"net"
"fmt"
"bufio"
"encoding/xml"
"encoding/hex"
"crypto/md5"
"math"
"os"
@CallMeFoxie
CallMeFoxie / allow-labels.diff
Created November 22, 2019 11:27
Allow changing node.kubernetes.io/* node labels within kubelet
diff --git a/pkg/kubelet/kubelet_node_status.go b/pkg/kubelet/kubelet_node_status.go
index cb13ec735f..f50cdab917 100644
--- a/pkg/kubelet/kubelet_node_status.go
+++ b/pkg/kubelet/kubelet_node_status.go
@@ -176,6 +176,13 @@ func (kl *Kubelet) updateDefaultLabels(initialNode, existingNode *v1.Node) bool
}
}
+ for labelKey, labelValue := range initialNode.Labels {
+ if kubeletapis.IsKubeletLabel(labelKey) {
@CallMeFoxie
CallMeFoxie / extendedresources.diff
Created November 22, 2019 11:26
Allow setting extended resources from within kubelet flags [kubernetes 1.16.3]
diff --git a/cmd/kubelet/app/options/options.go b/cmd/kubelet/app/options/options.go
index 1b60f2cea45..5b245b7faa1 100644
--- a/cmd/kubelet/app/options/options.go
+++ b/cmd/kubelet/app/options/options.go
@@ -144,6 +144,8 @@ type KubeletFlags struct {
ExperimentalNodeAllocatableIgnoreEvictionThreshold bool
// Node Labels are the node labels to add when registering the node in the cluster
NodeLabels map[string]string
+ // Extended resources of a node to register/update with
+ ExtendedResources map[string]string