Skip to content

Instantly share code, notes, and snippets.

View cwilper's full-sized avatar

Chris Wilper cwilper

View GitHub Profile
@cwilper
cwilper / build-epub.sh
Created August 8, 2014 13:01
Build sonatype/nexus-book in EPUB Format
#!/bin/bash
set -e
echo "Converting images if needed"
cd figs
./convert.sh
cd ..
echo "Building epub version of book"
mkdir -p target
@cwilper
cwilper / gist:ec9c4f8925f1d181dfdc
Last active August 29, 2015 14:19
Cheryl's Birthday Reasoning
See http://www.washingtonpost.com/news/morning-mix/wp/2015/04/14/when-is-cheryls-birthday-the-math-problem-that-stumped-the-internet/
Cheryl's Birthday Reasoning
===========================
Cheryl tells Albert the month of her birthday, and she tells Bernard
the day of her birthday. She also tells them both that her birthday
is one of the following 10 dates:
May 15 16 19
@cwilper
cwilper / gist:0d7506b03906f0676541
Last active August 29, 2015 14:23
wget commandline for oracle jdk unattended install
# Find the url to the latest .tar.gz for linux at the following url and populate it below:
# http://www.oracle.com/technetwork/java/javase/downloads/index.html
URL=??
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" $URL
rpm -y install filename.tar.gz
# If you want to set it/select it as the system-wide "alternative" on CentOS/RHEL,
# see http://tecadmin.net/steps-to-install-java-on-centos-5-6-or-rhel-5-6/
@cwilper
cwilper / git-retag
Created December 11, 2010 17:07
Hack to replace a git annotated/signed tag with a newly-named, signed one.
#!/bin/sh
# Name : git-retag
# Created : 2010-12-11
# Author : cwilper
# Purpose : Replaces an existing git annotated or signed tag with a new,
# signed one, using the original tagger name, email address,
# tag date, and 1-line message.
#
# Usage: git-retag oldname newname
@cwilper
cwilper / ThreadDumper.java
Created July 1, 2011 12:03
Java utility class for doing in-VM thread dumps. Was useful for tracking down the cause of FCREPO-946.
import java.util.Map;
/**
* Static methods for dumping current thread names, states, and stack
* traces, in the context of the currently executing JVM.
*/
public class ThreadDumper {
public static void dump(String name) {
dump(name, false);
@cwilper
cwilper / sself
Created October 10, 2011 03:00
Small Self-Extracting Archiver
#!/bin/sh
# Name : sself
# Created : 2011-10-09
# Author : cwilper
# Purpose : Creates a self-extracting archive (a shell script containing a
# compressed tar file) out of the content of a given directory. When
# executed, the archive will be expanded into /tmp/sself/ (which will
# be cleared first if it already exists), and if a "run" script exists
# in the root of the archive, it will be executed. Standard output and
[root@ip-10-244-95-152 ~]# vi /tmp/install-selenium-stuff.sh
[root@ip-10-244-95-152 ~]# chmod 755 /tmp/install-selenium-stuff.sh
[root@ip-10-244-95-152 ~]# /tmp/install-selenium-stuff.sh
Loaded plugins: fastestmirror, priorities, security, update-motd
Loading mirror speeds from cached hostfile
* amzn-main: packages.us-east-1.amazonaws.com
* amzn-updates: packages.us-east-1.amazonaws.com
* centos-base: mirror.7x24web.net
* centos-update: centos.mirror.nac.net
amzn-main | 2.1 kB 00:00
@cwilper
cwilper / jheap
Last active October 27, 2015 15:17
#!/bin/bash
#
# Prints the number of MB in the Old Generation and how many
# MB are consumed by top memory-consuming classes.
#
# Usage: jheap [-gc] process_id
#
# -gc will cause a GC to be triggered just before the measurement
#

Keybase proof

I hereby claim:

  • I am cwilper on github.
  • I am cwilper (https://keybase.io/cwilper) on keybase.
  • I have a public key whose fingerprint is 9316 C0C1 B5A6 2552 5568 335D 1173 084A BA6C 1222

To claim this, I am signing this object:

#!/bin/bash
#
# Dumps a subset of one Solr core and loads it into another one.
#
# WARNING: THIS DUMP AND LOAD IS LOSSY -- DO NOT USE IT FOR BACKUPS!
# In particular, multi-valued fields won't import in the target exactly as they were in the source.
#
# Before running, change the variables below as needed for your task.
#