Skip to content

Instantly share code, notes, and snippets.

@trastle
trastle / build log
Last active December 21, 2015 22:42
Building the UAA
tastle@tastle-w500 G=master uaa $ mvn clean install
[INFO] Scanning for projects...
[WARNING] The POM for org.springframework.build.aws:org.springframework.build.aws.maven:jar:3.0.0.RELEASE is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.cloudfoundry.identity:cloudfoundry-identity-common:jar:1.4.4
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ org.cloudfoundry.identity:cloudfoundry-identity-parent:1.4.4, /home/tastle/NotMyCode/uaa/pom.xml, line 155, column 21
[WARNING]
[WARNING] Some problems were encountered while building the effective model for org.cloudfoundry.identity:cloudfoundry-identity-scim:jar:1.4.4
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-javadoc-plugin is missing. @ org.cloudfoundry.identity:cloudfoundry-identity-parent:1.4.4, /home/tastle/NotMyCode/uaa/p
@trastle
trastle / git-config.sh
Last active December 20, 2015 18:18
Configure git to be a bit more awesome.
#!/bin/bash
# Just correct my typos
git config --global help.autocorrect 1
# Configure git to cache HTTPS passwords for 6 hours
git config --global credential.helper cache
git config credential.helper 'cache --timeout=21600'
# Disable SSL checks if we are using self signed certs
@trastle
trastle / mirror-repo.sh
Last active December 19, 2015 22:49
Small script to mirror the OpenShift Origin nightly repos File locations openshift-origin-deps.repo -> /etc/yum.repos.d/openshift-origin-deps.repo openshift-origin-nightly.repo -> /etc/yum.repos.d/openshift-origin-nightly.repo
#!/bin/bash
LOG_FILE="/tmp/openshift-repo-mirror.log"
function doLog {
timestamp=`date +%Y/%m/%d\ %H:%M:%S\(%z\)`
echo "$timestamp | $@" >> "$LOG_FILE"
}
function doMirror()
@trastle
trastle / etc_sysconfig_iptables
Created July 15, 2013 15:12
iptables NAT rule to send traffic on port 80 to a service running on 8080
## begin nat
*nat
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A PREROUTING -i eth2 -p tcp --dport 80 -j DNAT --to-destination :8080
COMMIT
### end nat
@trastle
trastle / add_alternative_jdk.sh
Created July 15, 2013 10:33
Script to add a new JDK as the first alternative in /etc/alternatives.
#!/bin/bash
# The location of the JDK
NEW_JDK_LOCATION="/opt/java/jdk1.7.0_25"
sudo update-alternatives --install "/usr/bin/java" "java" "$NEW_JDK_LOCATION/bin/java" 1
sudo update-alternatives --install "/usr/bin/javac" "javac" "$NEW_JDK_LOCATION/bin/javac" 1
sudo update-alternatives --install "/usr/bin/javaws" "javaws" "$NEW_JDK_LOCATION/bin/javaws" 1
sudo update-alternatives --install "/usr/bin/jarsigner" "jarsigner" "$NEW_JDK_LOCATION/bin/jarsigner" 1
sudo update-alternatives --install "/usr/bin/javah" "javah" "$NEW_JDK_LOCATION/bin/javah" 1
@trastle
trastle / 99fixbadproxy
Last active February 7, 2022 13:46
Fixing the issue with apt caused by a bad local proxy: -1- Create 99fixbadproxy at: /etc/apt/apt.conf.d/99fixbadproxy -2- Run clear.sh
Acquire::http::Pipeline-Depth "0";
Acquire::http::No-Cache=True;
Acquire::BrokenProxy=true;
@trastle
trastle / etc yum.repos.d puppet-deps.repo
Created May 29, 2013 15:32
Main puppet repository and dependencies repository for CentOS6.
[puppetlabs-deps]
name=Puppet Labs Dependencies
baseurl=https://yum.puppetlabs.com/el/6/dependencies/x86_64/
enabled=1
gpgcheck=1
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
@trastle
trastle / csv2xlsx.vbs
Last active December 16, 2015 15:59
Helping a mate who needed to convert a bunch of CSVs to XLSX files.
' Does the following:
' 1: Convert all of the CVS in the current directory to XLSX files.
' 2: Deletes the CSVs
'
' Usage:
' 1: Place this script in the directory with the CSVs.
' 2: Double click it.
' 3: Jobs a good'un
'
' Borrowing heavily from here:
@trastle
trastle / tls.go
Last active December 16, 2015 15:49
A snippet of Go code for serving HTML pages and WebSockets over TLS (Secure Web Sockets) . This implementation avoids using the poorly performing EDHC cyphers which the HTTP packages uses as part of the default cypher suite. See the golang-nuts thread here for more info: https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/QTDzrcDQmmw
import (
"log"
"net/http"
"crypto/tls"
"net"
"code.google.com/p/go.net/websocket"
)
const (
tlsListenAddress = ":443" // Where are we listening for TLS connections (address:port)
@trastle
trastle / timestamp.js
Created April 19, 2013 09:34
Timestamp in JS (yuk)
function timeStamp() {
var d = new Date();
var hour = ('0' + d.getHours()).slice(-2);
var min = ('0' + d.getMinutes()).slice(-2);
var sec = ('0' + d.getSeconds()).slice(-2);
var mil = ('000' + d.getMilliseconds()).slice(-3);
return hour + ":" + min + ":" + sec + "(" + mil + ")";
}