Skip to content

Instantly share code, notes, and snippets.

/mnt/backup:
mount.mounted:
- device: 10.1.52.20:/mnt/ZFS-P1/VZ-Backups/
- fstype: nfs
- mkmnt: True
- persist: True
- opts:
- rw
- auto
- noatime
#!/bin/bash
# Hostname
echo "Hostname: "
read hostname
hostname $hostname
sed -ri "s#^HOSTNAME=.*#HOSTNAME=$hostname#" /etc/sysconfig/network
# IPs
echo "eth0 IP: "
addnode:
cmd.run:
- name: "php /usr/local/solusvm/scripts/addnode.php --type={{ pillar['nodetype'] }} --name={{ pillar['nodename'] }} --ip={{ pillar['nodeip'] }} --port={{ pillar['nodeport'] }} --id={{ pillar['nodeid'] }} --key={{ pillar['nodekey'] }}"
@kelchm
kelchm / New Node - Command
Last active August 29, 2015 13:56
Fixed!
salt-call event.fire_master '{"nodename": "TEST", "nodetype": "openvz", "nodeip": "1.1.1.1", "nodeport": "495", "nodeid": "GH5739CHE9VVBEJXBCBE", "nodekey": "GHDDJR7463GCKSBCBEUWDB"}' 'solusvm/addnode'
import salt
import socket
import os
import platform
import math
from salt.modules.network import ip_addrs
from psutil import virtual_memory
# Config
solusvm_config_path = "/usr/local/solusvm/data/solusvm.conf"
@kelchm
kelchm / Module Excerpt.js
Last active August 29, 2015 14:14
Module Excerpt
// Configure input fields
$scope.input = {
subjectType: {
name: 'subjectType',
label: 'Type',
},
subjectId: {
name: 'subjectId',
label: 'With ID',
},
@kelchm
kelchm / gist:4753037
Created February 11, 2013 06:55
Fix missing border for .MToolControl.stretch in e4_default_mac.css.
.MToolControl.stretch {
visibility: hidden;
}
The operation couldn’t be completed. (kCFStreamErrorDomainSSL error -9806.)
@kelchm
kelchm / logtruncate
Last active December 16, 2015 00:19
Simple bash script to truncate lines from the beginning of a file. Useful for dealing with large log files.
#!/bin/bash
function log_output {
logger -p daemon.warning $1
echo $1
}
function truncate_start {
FILE_PATH="$1"
SAVE_LINES=$2
F = new int[n][w];
// Initialize first row and first column to zero
for(int i = 0; i<n; i++)
{
F[i][0] = 0;
}
for(int i = 0; i<w; i++)
{
F[0][i] = 0;