Skip to content

Instantly share code, notes, and snippets.

View vonwenm's full-sized avatar

Marcelle von Wendland vonwenm

View GitHub Profile
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.TrueFileFilter;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrInputDocument;
import org.apache.solr.common.params.CommonParams;
import org.apache.solr.common.params.ModifiableSolrParams;
import org.apache.solr.common.params.SolrParams;
import org.apache.solr.core.CoreContainer;
//Use Apache Tika and Solr to crawl, index and search documents
//John Miedema http://johnmiedema.com
//-----------------------------------------------------------
//referenced libraries:
//Apache Tika 1.5
//Apache Solr 4.7.2
//Apache HttpClient 4.3.3 reqd to connect to Solr server
//Noggit json parser reqd for Solr commands
//-----------------------------------------------------------
//after Solr is downloaded, start it using the following commands
(ns pyrtsa.millisquuid
(:import java.security.SecureRandom
java.util.Date
java.util.Random
java.util.UUID))
(def ^:private secure-random
(delay (java.security.SecureRandom.)))
(defn- ^Long rand-long
@vonwenm
vonwenm / gist:71f5f20d8ccb5be8a627
Last active August 29, 2015 14:04
SQUUID - a sequential UUID
A very handy tool for sequential UUIDS fro https://github.com/clojure-cookbook/clojure-cookbook/blob/master/01_primitive-data/1-24_uuids.asciidoc
Here is the definition:
(defn squuid []
(let [uuid (java.util.UUID/randomUUID)
time (System/currentTimeMillis)
secs (quot time 1000)
lsb (.getLeastSignificantBits uuid)
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@vonwenm
vonwenm / BOXSTARTER
Created April 18, 2015 11:52
BOXSTARTER URL ROOT
START http://boxstarter.org/package/nr/url?
#As described here: http://boxstarter.org/Learn/WebLauncher
#The command to run, built from the raw link of this gist
#START http://boxstarter.org/package/nr/url?https://gist.github.com/automatonic/7771dfd7015a72453091/raw/4cbbf4811d11929ebe0f98c51f04e7476179c13f/example.boxstarter
#Special windowsy stuff. see http://boxstarter.org/WinConfig
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowProtectedOSFiles -EnableShowFileExtensions
Enable-RemoteDesktop
Install-WindowsUpdate
Disable-InternetExplorerESC
function Add-Path() {
[Cmdletbinding()]
param([parameter(Mandatory=$True,ValueFromPipeline=$True,Position=0)][String[]]$AddedFolder)
# Get the current search path from the environment keys in the registry.
$OldPath=(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
# See if a new folder has been supplied.
if (!$AddedFolder) {
Return 'No Folder Supplied. $ENV:PATH Unchanged'
}
# See if the new folder exists on the file system.
function Add-Path() {
[Cmdletbinding()]
param([parameter(Mandatory=$True,ValueFromPipeline=$True,Position=0)][String[]]$AddedFolder)
# Get the current search path from the environment keys in the registry.
$OldPath=(Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PATH).Path
# See if a new folder has been supplied.
if (!$AddedFolder) {
Return 'No Folder Supplied. $ENV:PATH Unchanged'
}
# See if the new folder exists on the file system.
# ==========================================================================
#
# Script Name: Install-Programs.ps1
#
# Author: Marcelle von Wendland
#
# Date Created: 19/04/2015
#
# Description: A environment setup script for dev machines
#