Skip to content

Instantly share code, notes, and snippets.

View itzg's full-sized avatar

Geoff Bourne itzg

View GitHub Profile
@itzg
itzg / ifcfg-eth1
Created February 15, 2014 16:54
Typical Redhat/CentOS ethernet device config for static addressing
DEVICE=eth1
HWADDR=08:00:27:6a:63:6c
TYPE=Ethernet
BOOTPROTO=static
IPADDR=192.168.56.10
PREFIX=24
DNS1=192.168.1.1
ONBOOT=yes
@itzg
itzg / grep-logs.sh
Created February 16, 2014 00:05
Grep a directory full of files for ERRORs and WARNINGs. I have been using this to diagnose issues when using OpenStack.
tail -n 500 *.log|egrep " ERROR | WARNING |^==>"|grep -v DEBUG
@itzg
itzg / Person.groovy
Created February 19, 2014 19:17
Using GroovyClassLoader to compile .groovy files on the fly
/* Located in /tmp/groovy/mine */
package mine
class Person {
int age
String name
}
@itzg
itzg / subnet-update.sh
Created February 25, 2014 22:44
This is how to change/add DNS servers to an existing OpenStack neutron subnet
neutron subnet-update private_subnet --dns_nameservers list=true 192.168.1.1 192.168.1.2
@itzg
itzg / StripTrailingPart.groovy
Created February 28, 2014 21:16
Using Groovy (via Java Pattern/Matcher) to pick off the last part of a delimited string
def m = 'one.two.three' =~ /(.*)\.(.*)/
assert(m)
assert(m[0][1] == 'one.two')
assert(m[0][2] == 'three')
@itzg
itzg / use-binary-nc.sh
Created March 16, 2014 00:24
Use netcat to debug binary content sent by a client socket
nc -l 8801 | od -A x -t x1
@Grapes(
@Grab(group='io.netty', module='netty-codec', version='4.0.17.Final')
)
import io.netty.buffer.PooledByteBufAllocator
def alloc = new PooledByteBufAllocator()
def buf = alloc.buffer()
assert(buf.refCnt() == 1)
@Grapes(
@Grab(group='io.netty', module='netty-codec', version='4.0.17.Final')
)
import io.netty.buffer.ByteBuf
import io.netty.buffer.Unpooled
import io.netty.bootstrap.ServerBootstrap
import io.netty.bootstrap.Bootstrap
import io.netty.channel.nio.NioEventLoopGroup
import io.netty.channel.socket.nio.NioServerSocketChannel
import io.netty.channel.socket.nio.NioSocketChannel
@itzg
itzg / Groovy collections plus vs left shift.md
Last active August 29, 2015 13:57
Groovy collections, left shift vs plus

Groovy collections...

Given two collections, dest and src:

def dest = [1]
def src = [2,3] as Set

...using the plus operator

dest += src

msm jargroup create bukkit https://dl.bukkit.org/latest-rb/craftbukkit.jar