Skip to content

Instantly share code, notes, and snippets.

@leitu
leitu / gist:ae30a4c1a1f342df1274
Last active August 29, 2015 14:12
logstash-forwarder
#! /bin/sh
# From The Logstash Book
# The original of this file can be found at: http://logstashbook.com/code/index.html
#
# logstash-forwarder Start/Stop logstash-forwarder
#
# chkconfig: 345 99 99
# description: logstash-forwarder
# processname: logstash-forwarder
# CentOS 7.0 kickstart for XenServer (PVHVM MBR)
# branch: develop
##########################################
# Install, not upgrade
install
cdrom
# Install from a friendly mirror and add updates
#url --url http://mirror.rackspace.com/CentOS/7.0.1406/os/x86_64/
@leitu
leitu / Gitd
Last active August 29, 2015 14:14
#!/bin/sh
#
# Startup/shutdown script for Git Daemon
# chkconfig: 345 56 10
#
# description: Startup/shutdown script for Git Daemon
#
. /etc/init.d/functions
DAEMON=/usr/libexec/git-core/git-daemon
# CentOS 6 Server kickstart for XenServer
# branch: master
##########################################
# Install, not upgrade
install
# Install from a friendly mirror and add updates
#repo --name=base --baseurl=http://10.18.2.179/CentOS/6.5/os-min
#repo --name=updates --baseurl=http://10.18.2.179/CentOS/updates/x86_64
@leitu
leitu / geminabox.conf
Created February 3, 2015 08:22
Nginx proxy
upstream geminabox{
server 10.18.2.179:8080;
}
server {
listen 8081;
server_name _;
root /repo/gems;
jenkins_script env_name do
command <<-EOH.gsub(/^ {8}/, '')
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.jenkins.plugins.awscredentials.*
domain = Domain.global()
store = Jenkins.instance.getExtensionList('com.cloudbees.plugins.credentials.SystemCredentialsProvider')[0].getStore()
credentials = new AWSCredentialsImpl(
@leitu
leitu / checkJenkins.sh
Created January 13, 2018 01:31 — forked from julianchurchill/checkJenkins.sh
A bash script to query a Jenkins server. Use like this: 'checkJenkins.sh <jobname>' and it will query the server with the given job name every 30s. Use like this: 'checkJenkins.sh <jobname> tmux' and it will query the server once and output tmux coloured messages appropriate to display in a tmux status bar. E.g. add this to your .tmux.conf 'set …
#!/bin/bash
CONSOLE_RED="\033[2;31m"
CONSOLE_GREEN="\033[2;32m"
CONSOLE_CLEAR="\033[0m"
JENKINS_SERVER=http://my_jenkins_server
JOB=$1
JOB_QUERY=/job/${JOB}
@leitu
leitu / jenkinsfile
Last active January 19, 2018 05:25
pipeline {
agent any
parameters {
string(name: 'COOKBOOKS', defaultVaule: "[jenkins,common,base]", description:"Add your cookbooks as []")
}
stages {
stage('fetch target chef') {
steps {
git 'ssh://git@github.com/leitu/chef-cookbook.git'
}
@leitu
leitu / check proxy
Created August 22, 2018 05:54
did some changes to pass shellcheck
#!/bin/bash
PROXYS='proxy.txt'
PROXY_TYPE='http'
CHECK_URL='https://api.ipify.org?format=json'
MAX_CONNECT=10
GOOD_ARR=()
FAIL_ARR=()
GOOD=0
FAIL=0
@leitu
leitu / Makefile
Created October 22, 2018 06:41 — forked from cjbarker/Makefile
Makefile for cross-compiling Golang. Just update BINARY var in Makefile and create empty vars in main.go for Version and Build
# ########################################################## #
# Makefile for Golang Project
# Includes cross-compiling, installation, cleanup
# ########################################################## #
# Check for required command tools to build or stop immediately
EXECUTABLES = git go find pwd
K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH)))