Skip to content

Instantly share code, notes, and snippets.

View cary205's full-sized avatar
:octocat:
(ㄏ ̄□ ̄)ㄏ

Cary Wu cary205

:octocat:
(ㄏ ̄□ ̄)ㄏ
View GitHub Profile
@cary205
cary205 / README.markdown
Created September 15, 2024 04:06 — forked from beccasaurus/README.markdown
MSBuild equivalent of Visual Studio "Publish"

Publish via MSBuild

Note: the publish-via-msbuild.bat shown here simply builds the site and drops it into a directory, transforming the Web.configs

It does NOT sync the directory in any meaningful way.

To do that, I recommend using a tool like Rsync or MSDeploy

MSDeploy example:

@cary205
cary205 / sha256 hash
Created March 16, 2023 09:46 — forked from pollux-/sha256 hash
Generating SHA256 hash of a public key from remote server certificate
Creating certificate from remote URL and writing to file (mycertfile.pem)
openssl s_client -showcerts -connect gist.github.com:443 </dev/null 2>/dev/null|openssl x509 -outform PEM >mycertfile.pem
Generating SHA256 hash of public key from a certificate (mycertfile.pem)
openssl x509 -in mycertfile.pem -pubkey -noout | openssl rsa -pubin -outform der | openssl dgst -sha256 -binary | openssl enc -base64
@cary205
cary205 / create-kube-user.sh
Created March 2, 2023 06:54 — forked from henning/create-kube-user.sh
create k8s user, certificate, permissions and client config
#!/bin/bash
CLUSTERNAME=mycluster.mydomain
NAMESPACE=default
USERNAME=myclusteruser
GROUPNAME=mygroup
openssl genrsa -out ${USERNAME}.key 2048
CSR_FILE=$USERNAME.csr
@cary205
cary205 / delete-evicted-pods-all-namespaces.sh
Created February 25, 2022 05:42 — forked from svx/delete-evicted-pods-all-namespaces.sh
Delete evicted pods from all namespaces (also ImagePullBackOff and ErrImagePull)
#!/bin/sh
# based on https://gist.github.com/ipedrazas/9c622404fb41f2343a0db85b3821275d
# delete all evicted pods from all namespaces
kubectl get pods --all-namespaces | grep Evicted | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff state from all namespaces
kubectl get pods --all-namespaces | grep 'ImagePullBackOff' | awk '{print $2 " --namespace=" $1}' | xargs kubectl delete pod
# delete all containers in ImagePullBackOff or ErrImagePull or Evicted state from all namespaces
@cary205
cary205 / rke2-commands.md
Created November 8, 2021 09:09 — forked from superseb/rke2-commands.md
RKE2 commands

RKE2 commands

Install

curl -sL https://get.rke2.io | sh
systemctl daemon-reload
systemctl start rke2-server
@cary205
cary205 / UnicodeReader.java
Created September 25, 2020 07:10
UnicodeReader.java
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PushbackInputStream;
import java.io.Reader;
public class UnicodeReader extends Reader {
private static final int BOM_SIZE = 4;
private final InputStreamReader reader;
@cary205
cary205 / exposing-applications.md
Created August 5, 2020 06:26
Accesing services and applications inside KIND
title menu
Accesing applications inside the cluster
main
parent identifier weight
user
exposing-applications
1

Accesing services and applications inside a kubernetes cluster

@cary205
cary205 / exposing-applications.md
Last active April 25, 2020 12:38
Accesing services and applications inside a kubernetes cluster
apiVersion: apps/v1
kind: Deployment
metadata:
name: hello-deployment
spec:
replicas: 2
selector:
matchLabels:
app: my-deployment
template:
@cary205
cary205 / script.js
Created November 8, 2019 01:46
(つェ⊂) 我藏好了哦~
var originTitle = document.title;
var titleTime;
document.addEventListener("visibilitychange", function() {
if (document.hidden) {
document.title = "(つェ⊂) 我藏好了哦~ " + originTitle;
clearTimeout(titleTime);
} else {
document.title = "(*´∇`*) 被你发现啦~ " + originTitle;
titleTime = setTimeout(function() {
document.title = originTitle;