Skip to content

Instantly share code, notes, and snippets.

Chris Wilper cwilper

  • Rochester, NY
Block or report user

Report or block cwilper

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cwilper
cwilper / solr-ds7-preview1.md
Last active May 20, 2019
Setting up Solr for DSpace 7 Preview 1
View solr-ds7-preview1.md

Setting up Solr for DSpace 7 Preview 1

These steps worked for me (cwilper) as of 2019/05/20. You don't need to deploy Solr this way...I'm just documenting what worked for me today.

Define a BASE dir

This is the parent directory of your dspace and solr installs. For example, if you will be deploying your dspace install under $HOME/Work/dspace/community-7/dspace, then BASEDIR should be set as follows:

@cwilper
cwilper / CommandRunner.java
Last active Jan 30, 2019
Java example of using ProcessBuilder synchronously and reading stdout/err from temporary files. See main method.
View CommandRunner.java
package com.atmire.util;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@cwilper
cwilper / nginx.conf
Created Mar 15, 2018
Nginx Permanent Redirect for Handle Prefix Change
View nginx.conf
server {
# Permanently redirect default DSpace handle prefix URLs to new, registered handle prefix
rewrite ^/handle/123456789/(.*)$ /handle/PUT-REGISTERED-PREFIX-HERE/$1 permanent;
}
@cwilper
cwilper / Person.ts
Last active Mar 7, 2018
Typescript example: Constructor with optional args via interface.
View Person.ts
// 1. Define an interface for the optional args to your constructor.
interface PersonArgs {
nickname?: string;
age?: number;
}
class Person {
// 2. Add the args as the last parameter of the constructor, with a default value of {}.
View vrsync
#!/bin/bash
#
# Repeatedly performs rsyncs with the given arguments until
# the output seems to indicate there are no more changes, or
# a maximum number of iterations is reached, whichever comes first.
#
# Invoke the same way you would rsync. Verbose output is forced, since
# that's how it detects if any changes were transferred..so specifying
# -v is redundant.
#
@cwilper
cwilper / checkok.sh
Created Jul 10, 2017
Checks if a given url returns 200 ok and returns 0 if so, returns 1 (error) otherwise
View checkok.sh
#!/bin/sh
curl -Ssf "$1" > /dev/null
if [[ $? -ne 0 ]]; then
echo "Error: Non-200 returned for url $1"
exit 1
fi
@cwilper
cwilper / ImDim.java
Last active Apr 20, 2017
Get image size from file
View ImDim.java
import javax.imageio.ImageIO;
import javax.imageio.ImageReader;
import javax.imageio.stream.FileImageInputStream;
import javax.imageio.stream.ImageInputStream;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
/**
@cwilper
cwilper / TimesheetSnippet.vba
Created Apr 15, 2017
Excel VBA code snippets
View TimesheetSnippet.vba
'If G and H are defined for the given row, add the difference to K and clear them
Private Sub Update_Total(ByVal Row As Integer)
Dim punchStart, punchEnd, timeWorked As Integer
punchStart = Range("G" & Row).Value
punchEnd = Range("H" & Row).Value
timeWorked = punchEnd - punchStart
If (punchStart > 0 And punchEnd > 0 And timeWorked > 0) Then
Range("K" & Row).Value = Range("K" & Row) + timeWorked
Range("G" & Row).Value = ""
Range("H" & Row).Value = ""
@cwilper
cwilper / .tmux.conf
Last active Mar 24, 2017
My initial tmux config file
View .tmux.conf
# Here's my initial tmux config, which works well on macOS and Linux,
# and uses screen-like and vi bindings. If using Linux, see notes about
# xclip below.
#
# If you use iTerm and homebew on a mac, you can set it up to automatically
# launch a new tmux session whenever a new terminal window opens:
#
# 1) Install tmux (e.g. via homebrew: brew install tmux)
# 2) Put this file in your home directory, named .tmux.conf
# 3) Edit your iTerm Preferences:
View BAx.md
You can’t perform that action at this time.