Skip to content

Instantly share code, notes, and snippets.

View ihcsim's full-sized avatar

Ivan Sim ihcsim

View GitHub Profile
@ihcsim
ihcsim / gist:3eb07eaf57bf3a4fc15e5e4bcc164d2b
Last active November 5, 2024 23:36
Sign Others' GPG Key
# pull the key from the remote key server
$ gpg [--keyserver keyserver.ubuntu.com] --recv-keys <remote_key_id>
 
# sign the key
$ gpg --sign-key <key_id>
 
# if there are multiple local keys, use a different local secret key for signing
$ gpg --local-user <local_key_id> --sign-key <remote_key_id>
 
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"image.openshift.io/v1","kind":"ImageStream","metadata":{"annotations":{},"labels":{"app":"battle-demo","app.kubernetes.io/component":"battle-demo","app.kubernetes.io/instance":"battle-demo"},"name":"battle-demo","namespace":"isim-dev"},"spec":{"lookupPolicy":{"local":false},"tags":[{"annotations":{"openshift.io/imported-from":"quay.io/battlecloud/demo:latest"},"from":{"kind":"DockerImage","name":"quay.io/battlecloud/demo:latest"},"generation":2,"importPolicy":{"importMode":"Legacy"},"name":"latest","referencePolicy":{"type":"Source"}}]}}
openshift.io/image.dockerRepositoryCheck: "2023-10-04T15:55:41Z"
creationTimestamp: "2023-10-04T15:55:39Z"
generation: 2
labels:
apiVersion: oadp.openshift.io/v1alpha1
kind: DataProtectionApplication
metadata:
name: oadp-velero
namespace: velero-ppdm
spec:
backupImages: false
configuration:
restic:
enable: false
@ihcsim
ihcsim / curl.yaml
Last active February 13, 2023 18:55
SQLite StatefulSet YAML
apiVersion: v1
kind: Pod
metadata
name: curl
spec:
containers:
- name: curl
image: curlimages/curl:7.87.0
command: ["sleep", "infinity"]
$ cargo run
Compiling rust-ownership v0.1.0 (/home/isim/rust-ownership)
error[E0382]: borrow of moved value: `svc`
--> src/main.rs:24:28
|
12 | let svc = Service {
| --- move occurs because `svc` has type `Service<'_>`, which does not implement the `Copy` trait
...
19 | let mut nginx = svc;
| --- value moved here
use std::collections::HashMap;
#[derive(Debug)]
struct Service {
name: String,
namespace: String,
endpoints: Vec<String>,
mappings: HashMap<String, String>,
}
$ go run main.go
updated: {name:nginx namespace:ingress endpoints:[192.168.0.1 192.168.0.2 192.168.0.40] mappings:map[pod-0:192.168.0.1 pod-1:192.168.0.2 pod-2:192.168.0.40]}
original: {name:nginx namespace:default endpoints:[192.168.0.1 192.168.0.2] mappings:map[pod-0:192.168.0.1 pod-1:192.168.0.2 pod-2:192.168.0.40]}
type Service struct {
name string
namespace string
endpoints []string
mappings map[string]string
}
func main() {
svc := Service{
name: "nginx",
#[derive(Debug)]
struct Service {
name: String,
namespace: String,
}
fn main() {
let svcs = vec![
Service {
name: "nginx".to_string(),
#[derive(Debug)]
struct Service {
name: String,
namespace: String,
}
fn main() {
let svcs = vec![
Service {
name: "nginx".to_string(),