Skip to content

Instantly share code, notes, and snippets.

View jsturtevant's full-sized avatar
💻
right clicking and viewing the source

James Sturtevant jsturtevant

💻
right clicking and viewing the source
View GitHub Profile
@jsturtevant
jsturtevant / guaranteed-win.yaml
Created November 5, 2024 20:55
windows guaranteed
apiVersion: v1
kind: Pod
metadata:
name: test-affinity
spec:
nodeName: james-ms
containers:
- name: test-affinity
imagePullPolicy: Always
image: registry.k8s.io/e2e-test-images/busybox:1.36.1-1
Perf
| extend cluster = tostring(split(InstanceName, "/")[-3])
| where CounterName == "cpuUsageNanoCores"
| where cluster == "test-aks-27081-cluster"
| where Computer == "aks-nodepool1-12536813-vmss000000"
| summarize avg_cpu=avg(CounterValue/10000000), max_cpu=max(CounterValue/1000000000) by bin(TimeGenerated, 15m), InstanceName, Computer
| order by max_cpu asc
@jsturtevant
jsturtevant / config.yaml
Created May 30, 2024 23:41
empty windows kubelet config
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupsPerQOS: false
enforceNodeAllocatable: []
cpuManagerPolicy: static
systemReserved:
cpu: 500m
memory: 500Mi
authentication:
webhook:
@jsturtevant
jsturtevant / libc-handle-to-rust-ownedhandle.rs
Created May 2, 2024 23:05
convert libc handle to rust OwnedHandle
crates/containerd-shim-wasm/src/sys/windows/stdio.rs
```
pub fn as_owned(&self)-> Option<OwnedHandle> {
if let Some(fd) = self.as_raw_fd() {
return Some(unsafe {OwnedHandle::from_raw_handle(get_osfhandle(fd) as _)});
}
None
#!/usr/bin/env bash
set -e
echo test > test.txt
sudo ctr --debug -n ingest-bug content ingest --expected-size 5 --expected-digest sha256:f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2 test-content-foo < test.txt
sudo ctr --debug -n ingest-bug content ls
sudo ctr --debug -n ingest-bug content rm sha256:f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2
sudo ctr --debug -n ingest-bug content ingest --expected-size 5 --expected-digest sha256:f2ca1bb6c7e907d06dafe4687e579fce76b37e4e93b7605022da52e6ccc26fd2 test-content-foo < test.txt
echo its there!
@jsturtevant
jsturtevant / termination.bat
Created January 4, 2024 20:12
termination-log investigation
PS C:\apps> cmd /c ver
Microsoft Windows [Version 10.0.25398.469]
mkdir C:\var\lib\test
new-item -ItemType file -name termination-log -Path C:\var\lib\test
.\ctr.exe i pull registry.k8s.io/e2e-test-images/busybox:1.36.1-1
.\ctr.exe run -rm --mount="src=c:\termination-log,dst=c:\dev\termination-log" --user ContainerUser registry.k8s.io/e2e-test-images/busybox:1.36.1-1 test cmd
@jsturtevant
jsturtevant / vhd-to-sig.ps1
Created September 28, 2023 23:13
upload a vhd to a sig
$location="eastus"
$galleryName="SigWinTestingImages"
$resourceGroup="annual-channel"
$imageDefinition="capi-windows-annual"
$publisher="sigwincapi"
$offer="annualChannel"
$sku="original"
$storageAccountName="sigwin"
$subscription=""
$storageContainer="annualchvhd"
@jsturtevant
jsturtevant / test.sh
Created August 18, 2023 22:33
run test till failure
#!/usr/bin/env bash
counter=0
while [ $counter -lt 100 ]; do
let counter++
echo "Attempt: $counter"
# Run the command
@jsturtevant
jsturtevant / setting.json
Created August 9, 2023 19:50
vs code wasm-edge settings for rust
{
"rust-analyzer.cargo.noDefaultFeatures": true,
"rust-analyzer.cargo.extraEnv": {
"WASMEDGE_LIB_DIR": "C:\\Program Files\\WasmEdge\\lib",
"WASMEDGE_INCLUDE_DIR": "C:\\Program Files\\WasmEdge\\include"
}
}