Skip to content

Instantly share code, notes, and snippets.

sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum -y install jenkins
sudo yum -y install java-1.7.0-openjdk.x86_64
# Login as the jenkins user and specify shell explicity,
# since the default shell is /bin/false for most
# jenkins installations.
sudo su jenkins -s /bin/bash
"\e[1~": beginning-of-line
"\e[4~": end-of-line
“\e[5~”: history-search-backward
“\e[6~”: history-search-forward
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
@bzz
bzz / ls-large-files.sh
Last active December 28, 2015 22:58
Searches for (and remove) large files from git repository
#!/bin/bash
#Lists all large files in git repostory for the given branch.
#Needs to be run from repository subdirecory,
#Assumes git and perl are availblse
#
#http://blog.jessitron.com/2013/08/finding-and-removing-large-files-in-git.html
# and http://git-scm.com/book/ch6-4.html for repo history rewrite exlanation
#
#To get argregated statistics on output use:
#!/bin/sh
# This program has two feature.
#
# 1. Create a disk image on RAM.
# 2. Mount that disk image.
#
# Usage:
# $0 <dir> <size>
#
@bzz
bzz / mac_os_x_java_variants.sh
Last active December 31, 2015 00:28
Multiple JDK on mac os x 10.8 to switch Oracle \ Apple provided java implementations
#Thanks to http://superuser.com/questions/490425/how-do-i-switch-between-java-7-and-java-6-on-os-x-10-8-2
echo "Oracle JDK installed:"
ll /Library/Java/JavaVirtualMachines
echo "Apple supplied JDK:"
ll /System/Library/Java/JavaVirtualMachines
echo "To run a specifinc version use:"
/usr/libexec/java_home -v 1.6 --exec java -version
/usr/libexec/java_home -v 1.7 --exec java -version
@bzz
bzz / maven_deploy_to_github.sh
Last active December 31, 2015 17:29
Maven deploy artifact to repository hosted on GitHub
#!/bin/bash
mvn -DaltDeploymentRepository=snapshot-repo::default::file:../mvn-repo/snapshots clean deploy
#or
mvn deploy:deploy-file -DgroupId="com.nflabs" \
-DartifactId="scslogs" \
@bzz
bzz / create-new-user.sh
Created May 15, 2014 03:48
Create a new user on a multiple linux machines
#!/bin/bash
#
# Creates new user with given passwd on the set of machines
hosts="$@"
total_created=0
for host in ${hosts}; do
ssh -t root@"${host}" <<'ENDSSH'
useradd PLACE-USER-HERE -p PLACE-ENCRIPTED-PASSWORD-HERE(i.e from /etc/shadow)
ENDSSH

I used to think that

ssh -X me@some.box

"just bloody worked". However this might not work - ssh must play ball on both sides of the link. On the remote (ssh server, X client) sshd must sit behind some port, tell Xlib to send X11 requests to it and then forward them back to you the X server (where the ssh client is). If the remote box is locked down to prevent this, you will get:

X11 forwarding request failed on channel 0

as part of an otherwise working login. As it happens, I am the admin of the remote box in question, so I followed the ArchWiki and went to /etc/ssh/sshd_config and uncommented

@bzz
bzz / install-parallel-centos-6.sh
Last active March 30, 2019 01:18
Install GNU Parallel on CentOS 6
#!/bin/bash
# Install parallel on CentOS 6.
# Assumes you are root. Prefix w/ sudo if not.
cd /etc/yum.repos.d/
#wget http://download.opensuse.org/repositories/home:tange/CentOS_CentOS-5/home:tange.repo
wget http://download.opensuse.org/repositories/home:/tange/CentOS_CentOS-6/home:tange.repo
yum install parallel
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.