Skip to content

Instantly share code, notes, and snippets.

View patlachance's full-sized avatar

Patrice Lachance patlachance

View GitHub Profile
@patlachance
patlachance / windows.md
Last active April 12, 2021 05:42
operating system commands

How do i delete saved passwords from Windows 10.

  1. Open the run command dialog with "Windows Key+R"
  2. Paste the following string "rundll32.exe keymgr.dll,KRShowKeyMgr"
@patlachance
patlachance / kubectl-commands.txt
Created March 31, 2021 06:29
Kubernetes cheat sheets
# show secrets
# from https://blog.zwindler.fr/2020/01/20/kubectl-tips-and-tricks-n2/
kubectl get secret name-of-secret -o go-template='
{{range $k,$v := .data}}{{printf "%s: " $k}}{{if not $v}}{{$v}}{{else}}{{$v | base64decode}}{{end}}{{"\n"}}{{end}}'
@patlachance
patlachance / README.md
Created February 10, 2021 08:26
Useful openshift / kubernetes commands

Identify CRDs and APIServices resources owned by an operator

Read: https://olm.operatorframework.io/docs/tasks/uninstall-operator/

To run before removing an operator, because operator's owned resources may not be removed to avoid data loss.

$ oc get csv cert-manager-operator.v0.15.3 \
     -o=jsonpath='{"customresourcedefinitions: "}{.spec.customresourcedefinitions.owned[].name}{"\n"}{"apiservicedefinitions: "}{.spec.apiservicedefinitions.owned[].name}{"\n"}'
@patlachance
patlachance / howto.md
Last active September 6, 2021 10:24
AWS Cli - Useful commands

KMS

Get all keys

for k in $(aws kms list-keys | jq -r '.[] | .[].KeyId'); 
  do aws kms describe-key --key-id $k | jq -r '.KeyMetadata)';
done

Command:

curl https://git.io/ -i -F "url=https://github.com/YOUR_GITHUB_URL" -F "code=YOUR_CUSTOM_NAME"

URLs that can be created is from:

  • https://github.com/*
  • https://*.github.com
  • https://*.github.com/*
  • https://*.github.io
curl https://raw.githubusercontent.com/powdahound/ec2instances.info/master/www/instances.json | jq -r ' .[] | [ .instance_type , .pricing."eu-west-1".linux.ondemand , .pricing."eu-west-1".linux.reserved."yrTerm1Convertible.noUpfront"] | @csv' > prices.csv
head prices.csv
"c5d.xlarge","0.218","0.173"
"m5a.2xlarge","0.384","0.311"
"c5.9xlarge","1.728","1.369"
"m5.24xlarge","5.136","4.147"
"i3en.12xlarge","6","4.721"
"m5d.12xlarge","3.024","2.445"
"c5.large","0.096","0.076"
@patlachance
patlachance / GoogleSpreadsheet.html
Created April 19, 2020 08:02 — forked from terrywbrady/GoogleSpreadsheet.html
Sample HTML/JS to parse a Google Spreadsheet
<!doctype html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
var spData = null;
function doData(json) {
spData = json.feed.entry;
}

Keybase proof

I hereby claim:

  • I am patlachance on github.
  • I am lachance (https://keybase.io/lachance) on keybase.
  • I have a public key ASDHkv3RdgZV1mhNtsVlnxoZ6ClNxUNSkA4il3oOKGihMAo

To claim this, I am signing this object:

@patlachance
patlachance / GIT_SSH_COMMAND.sh
Created August 16, 2018 14:16 — forked from larryli/GIT_SSH_COMMAND.sh
Git ssh socks proxy
#!/bin/sh
export GIT_SSH_COMMAND='ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"'
git config --global core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"'
git clone -c=core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"' git@github.com:larryli/ipv4.git
git config core.sshCommand 'ssh -o ProxyCommand="connect -S 127.0.0.1:1080 %h %p"'
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name yourdomain
ssl_certificate /etc/ssl/localcerts/yourdomain.crt;
ssl_certificate_key /etc/ssl/localcerts/yourdomain.key;
ssl_ecdh_curve prime256v1;
ssl_session_cache builtin:1000 shared:SSL:10m;