Skip to content

Instantly share code, notes, and snippets.

@kam1kaze
kam1kaze / nodelocaldns.sh
Last active December 12, 2019 17:39
install nodelocaldns on managed kubernetes clusters like GKE, EKS, AKS etc
#!/usr/bin/env bash
# Example:
#
# ❯ ./nodelocaldns.sh | kubectl apply -f -
# serviceaccount/node-local-dns created
# service/kube-dns-upstream created
# configmap/node-local-dns created
# daemonset.apps/node-local-dns created
#
@kam1kaze
kam1kaze / gke-switch
Last active September 11, 2019 14:02
GKE switcher
#!/usr/bin/env bash
set -eu
sedi () {
sed --version &>/dev/null && sed -i -- "$@" || sed -i "" "$@"
}
if ! command -v fzf &>/dev/null; then
echo 'Please install `fzf` https://github.com/junegunn/fzf#using-homebrew-or-linuxbrew'
@kam1kaze
kam1kaze / keybase.md
Created February 22, 2018 14:02
keybase.md

Keybase proof

I hereby claim:

  • I am kam1kaze on github.
  • I am kam1kaze (https://keybase.io/kam1kaze) on keybase.
  • I have a public key ASAxoAnjqASjGYy273bkXAYlaBQ8YQ2nZ7ywAs5mvf8Mqwo

To claim this, I am signing this object:

@kam1kaze
kam1kaze / formater.md
Last active April 11, 2018 12:07
vim.md

VIM allows execute external commands and replace neccessary line/block with the command output.

  • :. - current line
  • :% - full buffer
  • :1,10 - line range
  • :'<,'> - visually selected block

Format JSON with jq

:.!jq .
@kam1kaze
kam1kaze / Chef-solo.md
Last active February 7, 2018 11:17 — forked from vpack/Chef-solo.md
Chef Solo

Chef Solo is very useful for single server configuration management.

Chef Solo config file '/etc/chef/solo.rb' is optional and it defaults to repo='/var/chef/'.

Just copy cookbooks directly to /var/chef/cookbooks. Run them using chef-solo command.

For e.g

cp -a /var/chef/cache/cookbooks /var/chef/cookbooks
@kam1kaze
kam1kaze / gist:7b4954e26619b63324dad69e9dfabe31
Created February 5, 2018 20:07
chef_shell_firewall.log
# chef-shell -z
loading configuration: /etc/chef/client.rb
Session type: client
Loading....Using policy 'test' at revision '95108111a05c1247abfa80916650bf1b727528eb9cfb25ff54e6cdfd9000bf0b'
[2018-02-05T19:57:44+00:00] INFO: Run List is [["recipe[firewall::default]"]]
[2018-02-05T19:57:44+00:00] INFO: Run List expands to [firewall::default@2.6.3 (897084d)]
resolving cookbooks for run list: ["firewall::default@2.6.3 (897084d)"]
[2018-02-05T19:57:44+00:00] INFO: Loading cookbooks [firewall@2.6.3, chef-sugar@4.0.0]
Synchronizing Cookbooks:
. - firewall (2.6.3)
@kam1kaze
kam1kaze / jenkins.groovy
Created November 28, 2017 13:44
Jenkins tips and tricks
// {{ Disable Job DSL script approval
import javaposse.jobdsl.plugin.GlobalJobDslSecurityConfiguration
import jenkins.model.GlobalConfiguration
GlobalConfiguration.all().get(GlobalJobDslSecurityConfiguration.class).useScriptSecurity=false
// comment next line if we need to disable it only for current session
GlobalConfiguration.all().get(GlobalJobDslSecurityConfiguration.class).save()
// }}
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.plugins.credentials.impl.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import hudson.plugins.sshslaves.*;
domain = Domain.global()
store = Jenkins.instance.getExtensionList('com.cloudbees.plugins.credentials.SystemCredentialsProvider')[0].getStore()
@kam1kaze
kam1kaze / ioquake3_install.sh
Last active December 13, 2020 11:59
Install Quake 3 on Linux or OSX
#!/usr/bin/env bash
set -ex
if [[ "$OSTYPE" == "linux-gnu" ]]; then
# Linux
sudo apt-get update && sudo apt-get install ioquake3
mkdir -p ~/.q3a/baseq3 && pushd "$_"
elif [[ "$OSTYPE" == "darwin"* ]]; then
#!/usr/bin/env ruby
require 'yaml'
def parse_yaml(cl, align = '')
puts align + cl
reclass_dir = '/srv/salt/reclass'
yaml_file = if cl =~ /\.yml$/
cl
elsif File.exist?(reclass_dir + '/classes/' + cl.tr('.', '/') + '/init.yml')