Skip to content

Instantly share code, notes, and snippets.

View theothermattm's full-sized avatar

Matt M. theothermattm

View GitHub Profile
@theothermattm
theothermattm / gist:4583395
Last active December 11, 2015 09:58
Well, it looks like Apple uses Spring MVC :) Got this on an email verification page.
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
@theothermattm
theothermattm / oracle-to-date.sql
Created March 8, 2013 21:28
Oracle to_date with hour and minutes
select * from my_table where my_date_time > to_date('08-03-2013 16:00','dd-MM-yyyy HH24:MI') order by my_date_time;
@theothermattm
theothermattm / public-ip.sh
Created March 8, 2013 21:33
Find the *public* IP of a host (got this from a handy StackExchange post)
wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
@theothermattm
theothermattm / gist:5277168
Created March 30, 2013 15:45
SLF4J Parameterized Logging Example
// this
if ( logger.isDebugEnabled() ) {
logger.debug("Some code with a parameter: " + param1 + " - " + param2 + " - " + param3);
}
// becomes this
logger.debug("Some code with a parameter: {} - {} - {}", param1, param2, param3");
@theothermattm
theothermattm / node-stream-transform.js
Created January 30, 2014 12:42
Simple node.js app that transforms a pages content using streams. Uses npm request and npm express. http://localhost:3000/replace?url=https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions&match=Regular
var express = require('express');
var app = express();
app.get('/replace', function(req, res) {
var request = require('request');
var stream = require('stream');
var zlib = require('zlib');
var url = req.query.url;
@theothermattm
theothermattm / gist:8707598
Created January 30, 2014 12:43
Command line to change the git:// protocol to https:// for those behind a corporate firewall
git config --global url."https://".insteadOf git://
@theothermattm
theothermattm / gist:8740850
Last active August 29, 2015 13:55
Find out current octal permissions of a file for chmod-ing
# linux
stat -c %a FILE
# OS X
stat -f "%OLp" FILENAME
@theothermattm
theothermattm / gist:8743170
Created January 31, 2014 21:08
Get Oracle database name in a sql scrip
select sys_context('userenv','db_name') from dual;
@theothermattm
theothermattm / KeyAuthSetup.md
Last active December 19, 2016 12:24
Setting up keyauth fast
  • On each remote server:
mkdir -p ~/.ssh; touch ~/.ssh/authorized_keys; chmod -R 700 ~/.ssh;
cat .ssh/id_rsa.pub | ssh username@host "cat >> ~/.ssh/authorized_keys"
@theothermattm
theothermattm / gist:8793406
Created February 3, 2014 22:06
List java home directories on OS X
/usr/libexec/java_home -V