Skip to content

Instantly share code, notes, and snippets.

View mohclips's full-sized avatar

mohclips mohclips

View GitHub Profile
@mohclips
mohclips / deploy.yml
Created January 7, 2020 21:40
k8s get-iplayer
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: get-iplayer
spec:
selector:
matchLabels:
tier: media
replicas: 1
@mohclips
mohclips / vmware_inventory_fast.ini
Created November 26, 2019 11:24
FAST vmware dynamic inventory
# Ansible VMware external inventory script settings
[vmware]
# The resolvable hostname or ip address of the vsphere
server=172.16.0.1
# The port for the vsphere API
port=443
# The username with access to the vsphere API
username=myuser
# The password for the vsphere API
@mohclips
mohclips / read-remote-yaml.yml
Created November 26, 2019 11:21
Read a remote yaml file
- hosts: search_master, search_data
serial: 1 # run one at a time
gather_facts: false
become: yes
vars:
# cannot be done as lookup are only on the Ansible controller
#config: "{{ lookup('file','/etc/elasticsearch/elasticsearch.yml') | from_yaml }}"
@mohclips
mohclips / process.py
Created February 11, 2019 19:35
Example of subprocess.checkoutput and rndc
def reload_zone(origin):
for action in ['status','freeze', 'reload', 'thaw', 'status']:
print('doing... rndc', action, origin)
cmd = ['/usr/sbin/rndc', action, origin]
try:
Out = subprocess.check_output(cmd,stderr=sys.stdout.buffer,universal_newlines=True)
print("{}".format(Out))
except subprocess.CalledProcessError as rndcexc:
print("Error code {} {}".format(rndcexc.returncode, rndcexc.output))
@mohclips
mohclips / dash-button.py
Created March 18, 2018 16:18
Search for Amazon Dash Button presses...
#!/usr/bin/python2.7
from scapy.all import *
FILTER='ether dst ff:ff:ff:ff:ff:ff'
def go_cat_go():
print "Go Cat dash button pressed"
def boldly_go():
@mohclips
mohclips / ownet-collectd.py
Created February 7, 2018 22:10
collectd plugin to read ownet
#!/usr/bin/python -u
from time import localtime, strftime
from pyownet import protocol
hostname="rpi-loft"
port=4304
interval=60
@mohclips
mohclips / collectd.conf
Created February 7, 2018 21:53
RPi collctd config
#
FQDNLookup false
#BaseDir "/var/lib/collectd"
#PluginDir "/usr/lib/collectd"
#TypesDB "/usr/share/collectd/types.db" "/etc/collectd/my_types.db"
Interval 30
#Timeout 2
ReadThreads 4
#!/bin/bash
yum install -y httpd
service httpd start
chkconfig httpd on
groupadd www
usermod -a -G www k5user
chown -R root:www /var/www
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} +
find /var/www -type f -exec chmod 0664 {} +
@mohclips
mohclips / azure-build01.yml
Created November 27, 2017 22:14
Ansible script to build a network, subnet and VM on Azure
- name: Create Azure VM
hosts: localhost
connection: local
vars:
# {
# "offer": "UbuntuServer",
# "publisher": "Canonical",
# "sku": "16.04-LTS",
# "urn": "Canonical:UbuntuServer:16.04-LTS:latest",
@mohclips
mohclips / LinkedIn-less-feed-spam.js
Created November 25, 2017 21:37
A tamper monkey script to reduce the amount of spam in the LinkedIn feed
// ==UserScript==
// @name linkedin feed
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.linkedin.com/feed/
// @require http://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @grant none
// ==/UserScript==