View k8s_create_user_cert.sh
#!/bin/bash | |
# Create new user certificate and kubeconfig | |
# Run me as user 'root' on K8s master node | |
CA_LOCATION="/etc/kubernetes/pki" | |
KUBECONFIG="./kubeconfig" | |
KEY_LEN="2048" | |
DAYS_VALID="500" |
View SingletonClass.m
#import <Foundation/Foundation.h> | |
@interface SingletonClass : NSObject | |
@property (class, readonly) id sharedSingletonClass; | |
@end | |
@implementation SingletonClass | |
static SingletonClass *_sharedSingletonClass; |
View nagios_check_file_age.sh
#!/bin/bash | |
NAGIOS_EXIT_OK=0 | |
NAGIOS_EXIT_WARNING=1 | |
NAGIOS_EXIT_CRITICAL=2 | |
NAGIOS_EXIT_UNKOWN=3 | |
FILES= | |
function help_and_exit() { |
View amq_exchange_sniffer.py
#!/usr/bin/env python | |
import sys | |
import optparse | |
import logging as log | |
from kombu import BrokerConnection | |
from kombu import Exchange | |
from kombu import Queue | |
from kombu.mixins import ConsumerMixin | |
class QueueDump(ConsumerMixin): |
View os_server_states.sql
-- list of VMs in stopped or shutdown status | |
SELECT display_name AS vm_name, vm_state, host, user_id, | |
(select name from keystone.project where id = project_id) AS project_name | |
FROM nova.instances | |
WHERE deleted = 0 AND vm_state NOT LIKE 'active' AND (power_state != 0x00); | |
-- nova quota usage (RAM, CPU) for a project | |
SELECT resource, in_use, reserved, user_id FROM nova.quota_usages | |
WHERE project_id = (SELECT id FROM keystone.project WHERE name like 'OS_TENANT_ID') |
View rabbitmq_check_crendetials.py
#!/usr/bin/env python | |
import socket | |
from kombu import Connection | |
host = "localhost" | |
port = 5672 | |
user = "username" | |
password = "secret" | |
vhost = "/" | |
url = 'amqp://{0}:{1}@{2}:{3}/{4}'.format(user, password, host, port, vhost) | |
with Connection(url) as c: |
View jenkins_delete_user_credentials.groovy
import com.cloudbees.plugins.credentials.* | |
import com.cloudbees.plugins.credentials.common.* | |
import com.cloudbees.plugins.credentials.domains.* | |
def credentials_for_username(String username) { | |
def username_matcher = CredentialsMatchers.withUsername(username) | |
def available_credentials = | |
CredentialsProvider.lookupCredentials( | |
StandardUsernameCredentials.class, | |
Jenkins.getInstance(), |
View jenkins_check_ssh_credentials.groovy
import com.cloudbees.plugins.credentials.* | |
import com.cloudbees.plugins.credentials.common.* | |
def credentials_for_username(String username) { | |
def username_matcher = CredentialsMatchers.withUsername(username) | |
def available_credentials = | |
CredentialsProvider.lookupCredentials( | |
StandardUsernameCredentials.class, | |
Jenkins.getInstance(), | |
hudson.security.ACL.SYSTEM |
View jenkins_add_ssh_credentials.groovy
import com.cloudbees.plugins.credentials.* | |
import com.cloudbees.plugins.credentials.common.* | |
import com.cloudbees.plugins.credentials.domains.* | |
import com.cloudbees.plugins.credentials.impl.* | |
import com.cloudbees.jenkins.plugins.sshcredentials.impl.* | |
credentials = new BasicSSHUserPrivateKey( | |
CredentialsScope.GLOBAL, | |
"", | |
"username_HERE", |