Skip to content

Instantly share code, notes, and snippets.

View thanad's full-sized avatar

Thanad Pansing thanad

  • King Power Click
  • Bangkok
  • X @thanad
View GitHub Profile
@thanad
thanad / read-only-clusterrole.yaml
Created January 27, 2022 11:03 — forked from just1689/clusterrole.yaml
Read only cluster role for Lens read only users
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: read-only-clusterrole
rules:
- nonResourceURLs:
- /metrics
verbs:
- get
- list
# This will use osd.5 as an example
# ceph commands are expected to be run in the rook-toolbox
1) disk fails
2) remove disk from node
3) mark out osd. `ceph osd out osd.5`
4) remove from crush map. `ceph osd crush remove osd.5`
5) delete caps. `ceph auth del osd.5`
6) remove osd. `ceph osd rm osd.5`
7) delete the deployment `kubectl delete deployment -n rook-ceph rook-ceph-osd-id-5`
8) delete osd data dir on node `rm -rf /var/lib/rook/osd5`
@thanad
thanad / cp_secrets.sh
Last active September 3, 2018 04:48 — forked from danrigsby/gist:8346b842d1446628de5223b600668dca
Copy kubernetes secrets between namespaces
kubectl get secrets -o json --namespace old | jq '.items[].metadata.namespace = "new"' | kubectl apply -f -
@thanad
thanad / gen-ssl.sh
Created January 1, 2018 13:03 — forked from thbkrkr/gen-ssl.sh
Generate Self-Signed SSL Certificate without prompt
# Generate a passphrase
openssl rand -base64 48 > passphrase.txt
# Generate a Private Key
openssl genrsa -aes128 -passout file:passphrase.txt -out server.key 2048
# Generate a CSR (Certificate Signing Request)
openssl req -new -passin file:passphrase.txt -key server.key -out server.csr \
-subj "/C=FR/O=krkr/OU=Domain Control Validated/CN=*.krkr.io"
@thanad
thanad / nginx.conf
Created October 12, 2017 08:51 — forked from jrom/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@thanad
thanad / ubuntu-php7-install.bash
Created November 11, 2016 08:54
Ubuntu 14.04 PHP7 (Install from Source)
#!/usr/bin/env bash
sudo -i;
apt-get update;
apt-get install --yes \
git \
bison \
autoconf \
@thanad
thanad / increase_swap.sh
Created January 19, 2016 11:03 — forked from shovon/increase_swap.sh
Increasing swap size. Only tested on the ubuntu/trusty64 Vagrant box. CREDIT GOES TO ---> http://jeqo.github.io/blog/devops/vagrant-quickstart/
#!/bin/sh
# size of swapfile in megabytes
swapsize=8000
# does the swap file already exist?
grep -q "swapfile" /etc/fstab
# if not then create it
if [ $? -ne 0 ]; then
@thanad
thanad / portforwarding.md
Last active December 14, 2015 10:05 — forked from kujohn/portforwarding.md
Port forwarding in Mavericks

Port Forwarding in Mavericks


Since Mavericks stopped using the deprecated ipfw (as of Mountain Lion), we'll be using pf to allow port forwarding.

####1. anchor file Create an anchor file under /etc/pf.anchors/<anchor file> with your redirection rule like:

require 'formula'
class FlashPlayer < Formula
url 'http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.app.zip'
md5 '2770acd6997bfd5016dd51acfb20c025'
homepage 'http://adobe.com'
version '11.1'
def install
name = 'Flash Player Debugger.app'
@thanad
thanad / l.php
Created July 15, 2013 08:02 — forked from adriengibrat/l.php
<?php spl_autoload_register(function($c){@include preg_replace('#\\\|_(?!.+\\\)#','/',$c).'.php';});