Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# get free memory
IFS=" " read USED FREE TOTAL <<<$(free -htm | grep "Mem" | awk {'print $3,$4,$2'})
# get processes
PROCESS=`ps -eo user=|sort|uniq -c | awk '{ print $2 " " $1 }'`
PROCESS_ALL=`echo "$PROCESS"| awk {'print $2'} | awk '{ SUM += $1} END { print SUM }'`
PROCESS_ROOT=`echo "$PROCESS"| grep root | awk {'print $2'}`
PROCESS_USER=`echo "$PROCESS"| grep -v root | awk {'print $2'} | awk '{ SUM += $1} END { print SUM }'`
@CobraKenji
CobraKenji / bot-mgmt-api.yml
Created May 26, 2019 00:05
Bot managment playbook to be called through API. Note: requires extra vars.
---
- hosts: localhost
gather_facts: no
become: true
become_user: root
become_method: sudo
vars:
- target_host: ''
tasks:
@CobraKenji
CobraKenji / deploy-hotbot.yml
Last active May 12, 2019 18:26
Deploy Snow's nodejs bot
---
- hosts: localhost
gather_facts: no
become: true
become_user: root
become_method: sudo
tasks:
- add_host:
name: "{{ target_host }}"
@CobraKenji
CobraKenji / 2-security.yml
Created April 28, 2019 22:40
2-security.yml
---
- hosts: test
roles:
- ansible-role-security
post_tasks:
- name: ensure fail2ban starts on a fresh reboot
service:
name: fail2ban
state: started
enabled: yes

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@CobraKenji
CobraKenji / ansible-summary.md
Created November 8, 2018 22:51 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of