Skip to content

Instantly share code, notes, and snippets.

[remote "host-one"]
url = jenkins@git:/${name}.git
push = +refs/heads/*:refs/heads/*
push = +refs/tags/*:refs/tags/*
timeout = 5
replicationDelay = 0
authGroup = Administrators
@jab416171
jab416171 / git_svn_bash_prompt.sh
Created September 25, 2012 18:21 — forked from woods/git_svn_bash_prompt.sh
Set color bash prompt according to git/svn branch, and return status of last command.
#!/bin/bash
#
# DESCRIPTION:
#
# Set the bash prompt according to:
# * the branch/status of the current git repository
# * the branch of the current subversion repository
# * the return value of the previous command
#
# USAGE:
NOVA_BRANCH=folsom-1
SWIFT_BRANCH=folsom-1
SWIFT_KEYSTONE_BRANCH=folsom-1
GLANCE_BRANCH=folsom-1
KEYSTONE_BRANCH=folsom-1
NOVNC_BRANCH=folsom-1
HORIZON_BRANCH=folsom-1
NOVACLIENT_BRANCH=folsom-1
KEYSTONECLIENT_BRANCH=folsom-1
#! /bin/sh
for i in $(sysctl -n kern.disks | awk '{for (i=NF; i!=0 ; i--) if (match($i, '/da/')) print $i }')
do
echo $i `smartctl -a /dev/$i | awk '/Temperature_Celsius/{DevTemp=$10;} /Serial Number:/{DevSerNum=$3}; /Device Model:/{DevName=$3} END { print DevTemp,DevSerNum,DevName }'`
done
#!/usr/bin/env python
import sys
filename = sys.argv[1]
token = sys.argv[2]
def set_contains(set, token):
for item in set:
if token in item:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
inet 127.0.0.1 netmask 0xff000000
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
epair3b: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=8<VLAN_MTU>
ether 02:54:89:xx:xx:xx
inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
@jab416171
jab416171 / bad
Created February 11, 2013 19:50
Vim doesn't autocomplete /home/$USER/a/b/c.sh if current working directory is /home/$USER
+ /etc/bash_completion:_filedir_xspec:3:IFS='
'
+ /etc/bash_completion:_filedir_xspec:4:COMPREPLY=()
+ /etc/bash_completion:_filedir_xspec:5:_get_comp_words_by_ref cur
+ /etc/bash_completion.d/git:_get_comp_words_by_ref:1:local exclude flag i OPTIND=1
+ /etc/bash_completion.d/git:_get_comp_words_by_ref:2:words=()
+ /etc/bash_completion.d/git:_get_comp_words_by_ref:2:local cur cword words
+ /etc/bash_completion.d/git:_get_comp_words_by_ref:3:upargs=()
+ /etc/bash_completion.d/git:_get_comp_words_by_ref:3:upvars=()
+ /etc/bash_completion.d/git:_get_comp_words_by_ref:3:local upargs upvars vcur vcword vprev vwords
@jab416171
jab416171 / gist:5238089
Created March 25, 2013 15:47
0x20 vs 0xc2a0
[09:39:13] ~$ xxd
if [[ "true" == "true" ]]; then echo "yes"; fi;
0000000: 6966 c2a0 5b5b 2022 7472 7565 2220 3d3d if..[[ "true" ==
0000010: 2022 7472 7565 2220 5d5d 3b20 7468 656e "true" ]]; then
0000020: 2065 6368 6f20 2279 6573 223b 2066 693b echo "yes"; fi;
0000030: 0a .
[09:39:25] ~$ xxd
if [[ "true" == "true" ]]; then echo "yes"; fi;
0000000: 6966 205b 5b20 2274 7275 6522 203d 3d20 if [[ "true" ==
0000010: 2274 7275 6522 205d 5d3b 2074 6865 6e20 "true" ]]; then
@jab416171
jab416171 / gist:5255264
Created March 27, 2013 15:46
Automatically detects if a user is logged into gmail, and if they are, will replace all the mailto: links on your webpage with links to the gmail compose window (automatically filling in the To field):
$('<img/>').hide()
.attr('src','https://mail.google.com/mail/photos/img/photos/public/AIbEiAIAAABDCKa_hYq24u2WUyILdmNhcmRfcGhvdG8qKDI1ODFkOGViM2I5ZjUwZmZlYjE3MzQ2YmQyMjAzMjFlZTU3NjEzOTYwAZwSCm_MMUDjh599IgoA2muEmEZD')
.load(function(){
$('a[href^="mailto:"]').each(function(){
var email = $(this).attr('href').replace(/^mailto:/,'');
$(this).attr('href','https://mail.google.com/mail/?view=cm&fs=1&tf=0&to='+escape(email));
});
})
.appendTo('body');
@jab416171
jab416171 / settings.xml
Created April 14, 2013 18:34
Maven settings.xml for Jenkins plugins
<settings>
<pluginGroups>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>
<profiles>
<!-- Give access to Jenkins plugins -->
<profile>
<id>jenkins</id>
<activation>