Skip to content

Instantly share code, notes, and snippets.

View vsfedorenko's full-sized avatar
🎯
Focusing

Vadim Fedorenko vsfedorenko

🎯
Focusing
View GitHub Profile
@DevOpsFu
DevOpsFu / main.tf
Created February 26, 2020 17:59
Terraform and Linkerd
resource "tls_private_key" "trustanchor_key" {
algorithm = "ECDSA"
ecdsa_curve = "P256"
}
resource "tls_self_signed_cert" "trustanchor_cert" {
key_algorithm = tls_private_key.trustanchor_key.algorithm
private_key_pem = tls_private_key.trustanchor_key.private_key_pem
validity_period_hours = 87600
is_ca_certificate = true
@pydevops
pydevops / private-k8s.md
Last active August 20, 2024 00:55
how to set up kubectl on laptop for private endpoint ONLY k8s cluster (AWS/GCP/On prem)

HTTP tunnel

On prem k8s cluster set up with bastion vm

  1. Create a bastion vm in your data center or in cloud with connectivity set up (usually vpn) to the on prem data center.
  2. Install tinyproxy on the bastion vm and pick a random port as it would be too easy for spam bot with default 8888, set up as systemd service according to https://nxnjz.net/2019/10/how-to-setup-a-simple-proxy-server-with-tinyproxy-debian-10-buster/. Make sure it works by validating with curl --proxy http://127.0.0.1:<tinyproxy-port> https://httpbin.org/ip. And I don't use any user authentication for proxy, so I locked down the firewall rules with my laptop IP/32.
  3. Download the kubeconfig file for the k8s cluster to your laptop
  4. From your laptop, run
HTTPS_PROXY=<bastion-external-ip>:<tinyproxy-port> KUBECONFIG=my-kubeconfig kubectl get nodes
@bgromov
bgromov / git-reset-author.sh
Created June 23, 2016 17:50
Git: reset author for ALL commits
#!/bin/sh
# Credits: http://stackoverflow.com/a/750191
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Newname'
GIT_AUTHOR_EMAIL='new@email'
GIT_COMMITTER_NAME='Newname'
GIT_COMMITTER_EMAIL='new@email'
" HEAD
@ryantang
ryantang / Migrating Repos with Large Files to Github
Created May 10, 2016 19:45
how to convert your repo to git-lfs and rewrite history
1. When trying to migrate a repo to Github
```
git clone --bare ssh://git@gitserver.example.com:2222/project-name/repo-name.git #clone a bare repo locally
curl --header "Authorization: token <GITHUB API TOKEN>" --data '{"name": "repo-name", "description": "Migrated from project-name from gitserver.example.com" https://api.github.com/orgs/org-name/repos #create github repo
git push --mirror git@github.com:org-name/repo-name.git
```
you'll see an error like this:
@bastman
bastman / docker-cleanup-resources.md
Created March 31, 2016 05:55
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@Zearin
Zearin / python_decorator_guide.md
Last active September 22, 2024 05:39
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@ngpestelos
ngpestelos / remove-docker-containers.md
Last active August 20, 2024 19:34
How to remove unused Docker containers and images

May 8, 2018

I wrote this four years ago, so instead use this command:

$ docker rmi $(docker images -q -f dangling=true)