Skip to content

Instantly share code, notes, and snippets.

View carldanley's full-sized avatar

Carl Danley carldanley

View GitHub Profile
@superseb
superseb / k3s-etcd-commands.md
Last active November 2, 2024 14:56
k3s etcd commands

k3s etcd commands

etcd

Setup etcdctl using the instructions at https://github.com/etcd-io/etcd/releases/tag/v3.4.13 (changed path to /usr/local/bin):

Note: if you want to match th etcdctl binaries with the embedded k3s etcd version, please run the curl command for getting the version first and adjust ETCD_VER below accordingly:

curl -L --cacert /var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --cert /var/lib/rancher/k3s/server/tls/etcd/server-client.crt --key /var/lib/rancher/k3s/server/tls/etcd/server-client.key https://127.0.0.1:2379/version
@innovia
innovia / kubernetes_add_service_account_kubeconfig.sh
Last active January 29, 2024 23:00
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@mikejk8s
mikejk8s / gcp-autosnapshot
Created January 20, 2017 20:22
gcp autosnapshot
#!/bin/bash
# loop through all disks within this project and create a snapshot
gcloud compute disks list --format='value(name,zone)'| while read DISK_NAME ZONE; do
gcloud compute disks snapshot $DISK_NAME --snapshot-names gcs-$DISK_NAME-$(date "+%Y-%m-%d-%s") --zone $ZONE
done
#
# snapshots are incremental and dont need to be deleted, deleting snapshots will merge snapshots, so deleting doesn't lose anything
# having too many snapshots is unwieldly so this script deletes them after 60 days
#
gcloud compute snapshots list --filter="creationTimestamp<$(date -d "-2 days" "+%Y-%m-%d")" --regexp "(gcs.*)" --uri | while read SNAPSHOT_URI; do

Setting Up a Remote Server on AWS

Log into WFMU's aws with the credentials that you got from Jeff. Go to EC2 on that insanely cluttered menu, the icon is orange and it's up top on the left.

CREATE AN INSTANCE:
Start an instance by clicking that big blue button:

  • Select your VM image. Most of our apps use an Ubuntu 64-bit image, which is the last option in the list.
  • NEXT: Instance type, use Micro instances (t1.micro) for now and we can change it later :)
@pixelistik
pixelistik / Vagrantfile
Created March 11, 2015 22:42
Vagrant with self-provisioning Ansible playbook
Vagrant.configure(2) do |config|
config.vm.box = "trusty64"
config.vm.network "forwarded_port", guest: 8080, host: 9090
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
$script = <<SCRIPT
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active November 2, 2024 06:45
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@helen
helen / wp-chosen-tax-metabox.php
Last active April 24, 2022 02:25
Use Chosen for a replacement WordPress taxonomy metabox
<?php
/**
* WordPress Chosen Taxonomy Metabox
* Author: Helen Hou-Sandi
*
* Use Chosen for a replacement taxonomy metabox in WordPress
* Useful for taxonomies that aren't changed much on the fly and are
* non-hierarchical in nature, as Chosen is for flat selection only.
* You can always use the taxonomy admin screen to add/edit taxonomy terms.
* Categories need slightly different treatment from the rest in order to