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 / curl.md
Last active July 9, 2019 06:45 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@cary205
cary205 / double-number.js
Created June 10, 2019 05:24 — forked from joepie91/double-number.js
CommonJS module example
module.exports = function(number) {
return number * 2;
}
@cary205
cary205 / git_rebase.md
Created May 27, 2019 02:19 — forked from ravibhure/git_rebase.md
Git rebase from remote fork repo

In your local clone of your forked repository, you can add the original GitHub repository as a "remote". ("Remotes" are like nicknames for the URLs of repositories - origin is one, for example.) Then you can fetch all the branches from that upstream repository, and rebase your work to continue working on the upstream version. In terms of commands that might look like:

Add the remote, call it "upstream":

git remote add upstream https://github.com/whoever/whatever.git

Fetch all the branches of that remote into remote-tracking branches, such as upstream/master:

git fetch upstream