Skip to content

Instantly share code, notes, and snippets.

curl -s -XPUT localhost:9200/test/t/1 -d'
{
"message" : "this is a test!"
}
'
curl -s localhost:9200/test/_search -d '
{
"query" : {
"match_phrase" : {
@drewr
drewr / randpass.zsh
Last active December 11, 2015 03:39
#!/usr/bin/env zsh
LEN=${1:-10}
for i in {1..10}; do
</dev/urandom tr -dc a-z0-9 | head -c${LEN}
echo
done
## % ./randpass.zsh 12
#!/bin/sh
# Workaround for Virtualbox 4.2.6 on Debian Wheezy running 3.7-trunk
# (3.7.1) kernel package.
#
# Linux beta 3.7-trunk-amd64 #1 SMP Debian 3.7.1-1~experimental.1 x86_64 GNU/Linux
#
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=696664
bz2=$HOME/tmp/linux-3.7.6.tar.bz2
{
"bool": {
"should": [
{
"match": {
"bodyText": {
"boost": 1.0,
"query": "lda",
"type": "boolean"
}
(defun browse-latest-url (&optional arg)
(interactive "p")
(save-excursion
(search-backward-regexp "https?://" nil nil arg)
(browse-url-at-point)))
@drewr
drewr / sldb
Last active December 15, 2015 03:39
VirtualBox error: Storage for the medium '/home/aar/.vmfest/models/vmfest-CentOS-6.3-x86_64-minimal.vmdk' is not created (0x80BB0007)
[Thrown class org.virtualbox_4_2.VBoxException]
Restarts:
0: [QUIT] Quit to the SLIME top level
2013-03-19 08:40:21,098 DEBUG [operate-51] p.c.vmfest run-nodes with template {:min-ram 512, :id :CentOS-6.0-x86_64-netboot-4.1.6}
2013-03-19 08:40:21,099 DEBUG [operate-51] p.c.vmfest Looking for {:min-ram 512, :id :CentOS-6.0-x86_64-netboot-4.1.6} in {:ubuntu-12.04 {:os-type-id "Ubuntu_64", :sudo-password "vmfest", :no-sudo false, :image-name "ubuntu-12.04", :packager :apt, :username "vmfest", :os-family :ubuntu, :os-version "12.04", :uuid "/home/aar/.vmfest/models/vmfest-ubuntu-12.04.vdi", :os-64-bit true, :image-id "ubuntu-12.04", :password "vmfest", :description "Ubuntu 12.04 (64bit)"}, :CentOS-6.0-x86_64-netboot-4.1.6 {:sudo-password "vagrant", :private-key-path "/home/aar/.vmfest/models/vagrant-key", :network-type :nat, :no-sudo false, :image-name "CentOS-6.0-x86_64-netboot-4.1.6", :username "vagrant", :os-family :centos, :os-version 6.0, :uuid "/home/aar/.vmfest/models/vmfest-CentOS-6.0-x86_64-netboot-4.1.6.vmdk", :os-64-bit true, :image-id "CentOS-6.0-x86_64-netboot-4.1.6", :password "vagrant"}}
2013

Recently I ran into a vmfest issue where I was trying to run setup-model on a [Vagrant box][centosbox]. The exception looked like:

   Invalid byte 52 at offset 7 in '12322424' len=8
     [Thrown class java.lang.IllegalArgumentException]
   
   Restarts:
    0: [QUIT] Quit to the SLIME top level

Backtrace:

2013-03-19 18:08:04,392 DEBUG [operate-35] p.futures Start of node exception
clojure.lang.ExceptionInfo: throw+: {:origin-component "", :text "", :error-code 2147942487, :original-message "VirtualBox error: (0x80070057)", :original-error-type :E_INVALIDARG, :cause #<VBoxException org.virtualbox_4_2.VBoxException: VirtualBox error: (0x80070057)>, :type :vbox-runtime, :message "SATA device, SATA port, IDE port or IDE slot out of range, or file or UUID not found.", :full-message "SATA device, SATA port, IDE port or IDE slot out of range, or file or UUID not found.: VirtualBox error: (0x80070057)", :origin-id "00000000-0000-0000-0000-000000000000"}
at vmfest.virtualbox.conditions$wrap_exception.invoke(conditions.clj:110) ~[na:na]
at vmfest.virtualbox.conditions$wrap_vbox_exception.doInvoke(conditions.clj:131) ~[na:na]
at clojure.lang.RestFn.invoke(RestFn.java:425) ~[clojure-1.4.0.jar:na]
at vmfest.virtualbox.machine_config$attach_device.invoke(machine_config.clj:61) ~[na:na]
at vmfest.virtualbox.machine_c

Building a CentOS 6.4 vmfest model

  1. Retrieve ISO – http://www.gtlib.gatech.edu/pub/centos/6.4/isos/x86_64/CentOS-6.4-x86_64-minimal.iso
  2. Create new VBox guest
    • Pick Red Hat (64 bit) as the OS type.
    • Configure the first network adapter as host-only vboxnet0, and a second as NAT.
    • Attach the VBoxGuestAdditions.iso (for Debian it’s available in /usr/share/virtualbox).
  3. Run through the installer. Defaults are fine here.
  4. Reboot. Log in as root.