Skip to content

Instantly share code, notes, and snippets.

View mantono's full-sized avatar

Anton Österberg mantono

View GitHub Profile
@mantono
mantono / kube-proxy.sh
Created December 9, 2022 09:58
Create a proxy from your local host to kubernetes pod
#!/bin/sh
# 1 = namespace
# 2 = podname
# 3 = local port
# 4 = port in pod
POD=$(kubectl get pods --namespace $1|grep $2|head -n 1|cut -d " " -f 1 )
echo "Found pod $POD"
echo "Will forward localhost:$3 to pod on port $4"
sleep 1
kubectl --namespace $1 port-forward $POD $3:$4
@mantono
mantono / pub_key.asc
Last active February 16, 2023 22:02
PUBLIC PGP KEY
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBGHTkA8BEACzbujYxSjamB8mhhHHB/obUnpWJe1N8Ejen+RtQH+bG5pXZ7vC
+3ipPOeM+BQUMyVTpAFx1JEs7FcwSm6ULi08RlyUW/MfQJbWi/5LmRTPeI7JjhFa
H5zJnNCV/xnqO4vDBN7u2MIWn6z54Q00sQztZYuJwHkmTKRNGQbqBw50wp4JB55o
SvQl1s+fTkzFUY43Kg6C2vAeEcOfQuaRoOFyfPAX7Em9z8aDynRa0AeVAg6nWsXI
q+CGqZ4HA6gROjL4JrGq+6GmPE8wR328IhW1dTdQUD5QzTzds6/hRrGqoTsW1J2L
ypT0dpb45B1nQpxkHYWT28eMhP14OY4dZp+wvxN3VblA8j2I8i0pv4G/UKGn/BJG
ssdPhg09WoWTeVI08uRgWk4M8aXDK1CUXxJK5Jxqo2ZEGroMqBKFD0xm9RBMGlOC
gITRl6hk5TkdGdtkCgoIxCT/MJJAyCbsBWckZ6YKTo3yfsPnUz4IdGH8t8B6VEpZ
// Before rustfmt config change
let files: Vec<PathBuf> = FileWalker::from(dir)
.unwrap()
.filter(|f| filter_name(f, &pattern))
.collect();
// After rustfmt config change
let files: Vec<PathBuf> =
FileWalker::from(dir).unwrap().filter(|f| filter_name(f, &pattern)).collect();
@mantono
mantono / cpuinfo
Created February 16, 2020 18:13
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
stepping : 9
microcode : 0xca
cpu MHz : 1301.406
cache size : 4096 KB
physical id : 0
@mantono
mantono / pacman
Last active February 16, 2020 18:11
pacman -Q
a52dec 0.7.4-10
aalib 1.4rc5-13
acl 2.2.53-2
adobe-source-code-pro-fonts 2.030ro+1.050it-5
adwaita-icon-theme 3.34.3-1
alsa-lib 1.2.1.2-3
alsa-plugins 1.2.1-1
alsa-topology-conf 1.2.1-1
alsa-ucm-conf 1.2.1.2-1
alsa-utils 1.2.1-2
@mantono
mantono / dmesg
Created February 16, 2020 18:08
dmesg
[ 0.000000] microcode: microcode updated early to revision 0xca, date = 2019-09-26
[ 0.000000] Linux version 5.5.2-arch1-1 (linux@archlinux) (gcc version 9.2.0 (GCC)) #1 SMP PREEMPT Tue, 04 Feb 2020 18:56:18 +0000
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-linux root=UUID=65e1961c-80c6-4e8f-9f00-34da40e44ddd rw quiet
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Hygon HygonGenuine
[ 0.000000] Centaur CentaurHauls
[ 0.000000] zhaoxin Shanghai
[ 0.000000] x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
@mantono
mantono / lspci
Created February 16, 2020 18:05
lspci -vv
00:00.0 Host bridge: Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 02)
Subsystem: Dell Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ >SERR- <PERR- INTx-
Latency: 0
Capabilities: <access denied>
Kernel driver in use: skl_uncore
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02) (prog-if 00 [VGA controller])
DeviceName: Onboard IGD
{
"__typename": "Issue",
"number": 4,
"databaseId": 461065166,
"title": "Send ETAG and Cache-Control headers",
"body": "",
"url": "https://github.com/owner/my-repo/issues/4",
"state": "OPEN",
"updatedAt": "2019-07-01T09:50:21Z",
"createdAt": "2019-06-26T16:18:41Z",
@mantono
mantono / ListExtentions.kt
Last active October 29, 2019 17:14
Convert a List<T> to an Array<T> in Kotlin
@Suppress("UNCHECKED_CAST")
internal fun <T: Any> List<T>.toArray(clazz: Class<T>): Array<T> {
val actualClass: Class<T> = clazz.kotlin.javaObjectType
val array: Array<T> = java.lang.reflect.Array.newInstance(actualClass, size) as Array<T>
this.forEachIndexed { index: Int, obj: T ->
array[index] = obj
}
return array
}
@mantono
mantono / PrivateUnsecuredLoanApplicationCreated.json
Last active October 29, 2019 13:57
Private Unsecured Loan - Application Created, with applicant and co-applicant
{
"cloudEventsVersion" : "0.1",
"eventType" : "org.open-broker.v0.se.PrivateUnsecuredLoanApplicationCreated",
"eventTypeVersion" : "v0",
"source" : "/mycontext",
"eventID" : "C234-1234-1234",
"eventTime" : "2018-04-05T17:31:00Z",
"extensions" : {
"comExampleExtension" : "value"
},