Skip to content

Instantly share code, notes, and snippets.

@pwyliu
pwyliu / selenium
Last active December 16, 2015 14:09
SLES\opensuse init script for Selenium Grid hub. Adapted from https://stomp.colorado.edu/blog/blog/2011/12/05/on-selenium-grid-and-init-scripts/.
#!/bin/bash
### BEGIN INIT INFO
# Provides: selenium
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop Selenium
# Description: Selenium Grid
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */
menuitem[label="Add to Dictionary"] {
display: none !important;
}
#! /bin/sh
### BEGIN INIT INFO
# Provides: carbon-cache
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: carbon-cache init script
# Description: An init script for Graphite's carbon-cache daemon.
### END INIT INFO
@pwyliu
pwyliu / kick.py
Created October 18, 2013 00:06
function to puppet kick. need requests-futures.
def puppet_agentrun(vm_ip):
url = 'https://{}:{}/{}/run/no_key'.format(
vm_ip, AGENTAPI_PORT, AGENTAPI_ENV,
)
# First puppet run might take a long time to return, so we use futures to
# display progress indicator
fs = FuturesSession()
headers = {'Accept': 'pson', 'Content-Type': 'text/pson'}
@pwyliu
pwyliu / dynamic-puppet-environments.sh
Last active December 27, 2015 01:19 — forked from gaahrdner/dynamic-puppet-environments.sh
build script for jenkins + puppet + dynamic envs combo
#!/bin/bash
# Forked from https://gist.github.com/gaahrdner/4088204
# This script takes the following arguments:
# * -r the repository URL for your puppet modules
# * -p the destination directory to check out all the branches into
# * -d delete directories from destination that don't exist in repo
function die {
log $*
@pwyliu
pwyliu / dl5110cn.ppd
Created November 2, 2013 00:36
PPD file for Dell 5110cn. Extracted from the Dell Windows driver vA07. Works on Ubuntu.
*PPD-Adobe: "4.3"
*% Adobe Systems PostScript(R) Printer Description File
*% Copyright 1987-1996 Adobe Systems Incorporated.
*% All Rights Reserved.
*% Permission is granted for redistribution of this file as
*% long as this copyright notice is intact and the contents
*% of the file is not altered in any way from its original form.
*% End of Copyright statement
*FileVersion: "1.0"
*FormatVersion: "4.3"
def ldap_auth(username=None, password=None):
#Cannot use SASL DIGEST-MD5 bind until Server 2008 R2 SP1 or above
#http://msdn.microsoft.com/en-ca/library/cc223500.aspx
#import ldap.sasl
#auth_tokens = ldap.sasl.digest_md5(str(username), str(password))
#l.sasl_interactive_bind_s("", auth_tokens)
#strict checking of cert is disabled in debug mode
if site_config.APP_DEBUG_MODE:
#ldap.set_option(ldap.OPT_DEBUG_LEVEL, 65535)
@pwyliu
pwyliu / prep_es_disk.sh
Last active December 29, 2015 00:59
add xenserver disk to elasticsearch node
#! /bin/bash
set -e
mkdir /var/lib/elasticsearch
if [[ -b /dev/xvdb ]] ; then
pvcreate /dev/xvdb
lvmdiskscan
vgcreate vg_esdata /dev/xvdb
lvcreate --extents 100%FREE --name lv_esdata vg_esdata
vgscan
lvscan
@pwyliu
pwyliu / gist:8726801
Created January 31, 2014 04:54
Simple HP procurve switch conf
; J9280A Configuration Editor; Created on release #Y.11.44
hostname "my hostname"
snmp-server contact "my contact"
snmp-server location "my location"
no web-management
web-management ssl
no telnet-server
ip default-gateway 1.2.3.4
snmp-server community "my community for snmp v2" Operator
@pwyliu
pwyliu / lumberjack-suse
Last active August 29, 2015 13:56 — forked from shadabahmed/logstash-cert.sh
SLES/Suse init script for lumberjack (logstash-forwarder). Tested on SLES 11 SP1 with lumberjack 0.3.1.
#! /bin/sh
# BEGIN INIT INFO
# Provides: lumberjack
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Enable service provided by daemon.
### END INIT INFO