Skip to content

Instantly share code, notes, and snippets.

View salekseev's full-sized avatar

Stas Alekseev salekseev

View GitHub Profile
#!/bin/sh
KEY="temp..."
echo -n "Number of physical disks this system's RAID controller contains: "
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL | egrep '^(Adapter|Product Name|RAID Level Size State|Number Of Drives|Physical Disk|Raw Size|Link Speed|Media Type|Drive Temperature|Slot Number):' | grep 'Raw Size' | wc -l
/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL | egrep '^(Adapter|Product Name|RAID Level Size State|Number Of Drives|Physical Disk|Raw Size|Link Speed|Media Type|Drive Temperature|Slot Number):'
echo
#!/usr/bin/env python
import msgpack
import sys
try:
while True:
line = sys.stdin.readline().strip('\n')
try:
print msgpack.unpackb(line)
@salekseev
salekseev / jsonflatten.py
Created February 27, 2015 17:32
Python script that flattens a JSON file or a dictionary with nested lists and/or dictionaries.
"""
This flattens a JSON file or a dictionary with nested lists and/or dictionaries.
The output is a flattened dictionary that use dot-chained names for keys,
based on the dictionary structure. This allows for reconstructing the JSON
structure or converting it to other formats without loosing any structural
information.
"""
__author__ = "Stas Alekseev"
__version__ = '0.1'
# Cobbler generated configuration file for dnsmasq
# $date
#
no-poll
enable-dbus
# Disables DNS functionality
port=0
log-dhcp
read-ethers
# Name the components on this agent
a1.sources = r1
a1.sinks = k1
a1.channels = c1
# Describe/configure the source
a1.sources.r1.type = spooldir
a1.sources.r1.spoolDir = ~/source
a1.sources.r1.fileHeader = true
a1.sources.r1.basenameHeader = true
#!ipxe
set base-url http://alpha.release.core-os.net/amd64-usr/current
kernel ${base-url}/coreos_production_pxe.vmlinuz sshkey="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDDLFxjbgAC1xKhi/mEMyHe2z1sqw6stCxYfhT6pcdtpKyE2HLPaJKvNPJR2sKVfL2hlljt7n6KSHxo6csy/WPTDCvJhGAj1dbhOuu0ChUoU+bOin90yEnA5zW1s/etqLwq9os1HOpxQZhcEwQPTggSyGc3JBkkvBNC3l4Q768hQpzeZyaZ30wRAGuem+qMJ2FnFtE2MnAUwcKXdRQVYD+KnxudC1Xc9zOAaugUmHcX6es6zWqmLn+rFZtdvnnMcK+OnO6oP+Lmi63c3hmvGz5KtP3hf8Uj3PQ2SneG7zS1beik+RBkvNSkCyxxbc9LF38c+xL7elHLb+UTdfsnYcMz"
initrd ${base-url}/coreos_production_pxe_image.cpio.gz
boot
#!/usr/bin/ruby
Script_Info = {
'base repo location' => 'cobbler/ks_mirror/OL6.5-x86_64',
'base repo title' => 'OL6.5',
'updates repo location' => 'LocalRepo/ol-6.5-updates',
'updates repo title' => 'OL6.5-updates',
'repo file dir' => '/etc/yum.repos.d',
'new version string' => 'Oracle Linux Server release 6.4',
@salekseev
salekseev / nat_monitor.sh
Created May 1, 2014 02:10
AWS nat_monitor.sh script that works with latest EC2 API tools
#!/bin/sh
# This script will monitor another NAT instance and take over its routes
# if communication with the other instance fails
# NAT instance variables
# Other instance's IP to ping and route to grab if other node goes down
NAT_ID=i-5bf2250b
NAT_RT_ID=rtb-f0b07695
# My route to grab when I come back up