Simple collection of Groovy scripts to help me maintain some Jenkins systems.
See also https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
| # Reuse an existing ssh-agent on login, or create a new one. Append this to your .bashrc | |
| # I have no idea who the author of the original concept was for reusing agents. This | |
| # version also handles the case where the agent exists but has no keys. | |
| GOT_AGENT=0 | |
| for FILE in $(find /tmp/ssh-* -type s -user ${LOGNAME} -name "agent.[0-9]*" 2>/dev/null) | |
| do | |
| SOCK_PID=${FILE##*.} |
Simple collection of Groovy scripts to help me maintain some Jenkins systems.
See also https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
| #!/bin/bash | |
| interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) ) | |
| rulefile="rules.tmp" | |
| echo "" > $rulefile | |
| sudo pfctl -a com.apple/tun -F nat | |
| for i in "${interfaces[@]}" | |
| do | |
| RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}" | |
| echo $RULE >> $rulefile | |
| done |
| parent = dict() | |
| rank = dict() | |
| def make_set(vertice): | |
| parent[vertice] = vertice | |
| rank[vertice] = 0 | |
| def find(vertice): | |
| if parent[vertice] != vertice: | |
| parent[vertice] = find(parent[vertice]) |
| #!/usr/bin/env python | |
| # | |
| # DNS Result Comparison Utility | |
| # Author: https://twitter.com/chair6 | |
| # | |
| import argparse | |
| import dns.resolver | |
| import dns.rdatatype | |
| from collections import defaultdict |
| sudo aptitude -y install nginx | |
| cd /etc/nginx/sites-available | |
| sudo rm default | |
| sudo cat > jenkins | |
| upstream app_server { | |
| server 127.0.0.1:8080 fail_timeout=0; | |
| } | |
| server { | |
| listen 80; |
| """ | |
| A python library of constants and utility functions for using ANSI terminal escapes. | |
| Example usage: | |
| >>> import escapes as e | |
| >>> print e.FORECOLOUR(e.RED) + "this is red" + e.UNFORMAT | |
| """ | |
| ESC = "\033" # escape character for terminal | |
| CSI = ESC + "[" # Control Sequence Initiator |
by alexander white ©
| # create a tinycorelinux fs with custom .tcz packages | |
| # prerequisites: apt-get install squashfs-tools, npm i nugget -g | |
| # dl release + packages (add your packages here) | |
| nugget http://tinycorelinux.net/6.x/x86_64/release/CorePure64-6.3.iso http://tinycorelinux.net/6.x/x86_64/tcz/{pkg-config,make,gcc,gcc_base-dev,gcc_libs-dev,gcc_libs,glibc_base-dev,linux-3.16.2_api_headers,fuse}.tcz -c | |
| # to support compiling addons | |
| unsquashfs -f pkg-config.tcz | |
| unsquashfs -f make.tcz | |
| unsquashfs -f gcc.tcz |