Skip to content

Instantly share code, notes, and snippets.

View christiaan-janssen's full-sized avatar

Christiaan Janssen christiaan-janssen

  • Zoetermeer - Holland
View GitHub Profile
(defun knife-boostrap ()
"Bootstrap a new node using chef."
(interactive)
(let
((ip (read-string "Node IP: "))
(name (read-string "Node name: "))
(role (let ((choices '("default" "mid-server" "unifi-controller")))
(ido-completing-read "Role: " choices))))
(async-shell-command
(concat "knife boostrap " ip
@christiaan-janssen
christiaan-janssen / chef.el
Last active May 14, 2019 07:17
Run chef commands from emacs
;;; Package --- Sumary:
;;; Emacs main config file
;;; Commentary:
;;; Code:
(defun parent-directory (dir)
"return parent directory of dir"
(unless (equal "/" dir)
(file-name-directory (directory-file-name dir))))
export ZSH="~/.oh-my-zsh"
ZSH_THEME="bureau"
COMPLETION_WAITING_DOTS="true"
plugins=(
git
docker
emacs
kitchen
@christiaan-janssen
christiaan-janssen / init.vim
Last active May 10, 2019 09:19
vim config
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
if !filereadable(vimplug_exists)
if !executable("curl")
echoerr "You have to install curl or first install vim-plug yourself!"
execute "q!"
endif
echo "Installing Vim-Plug..."
echo ""
#set-option -g status-keys emacs
#set-option -g mode-keys emacs
# Remap prefix to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
(use-package treemacs
:ensure t
:defer t
:init
(with-eval-after-load 'winum
(define-key winum-keymap (kbd "M-0") #'treemacs-select-window))
:config
(progn
(setq treemacs-collapse-dirs (if (executable-find "python3") 3 0)
;;; Package --- Sumary:
;;; Commentary:
;;; Code:
;;; Create some ssane defaults
(setq delete-old-versions -1) ;; delete excessclojure play sound backup versions silently
(setq version-control t) ; use version control
(setq vc-make-backup-files t) ; make backups file even when in version controlled dir
(setq backup-directory-alist `(("." . "~/.emacs.d/backups"))) ; which directory to put backups file
# Delete running pod
kubectl get pods | grep Running | awk '{print $1}' | xargs kubectl delete pods
# Delete all evicted pods
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pods
@christiaan-janssen
christiaan-janssen / plot_load.py
Last active April 14, 2017 12:19
Poor mans load graphs
"""
Plot the load of a server with https://plot.ly
save load with:
while :
do
echo `uptime` >> load.txt
sleep 1m
done
@christiaan-janssen
christiaan-janssen / add_users_to_www-data.sh
Created July 9, 2015 11:51
Find users and add them to a group
for user in `cat /etc/passwd | grep '._it' | cut -f1 -d':'`
do
`usermod -a -G www-data $user`
done