Skip to content

Instantly share code, notes, and snippets.

@theothermattm
theothermattm / gist:4583395
Last active Dec 11, 2015
Well, it looks like Apple uses Spring MVC :) Got this on an email verification page.
View gist:4583395
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 Mar 8, 2013
Oracle to_date with hour and minutes
View oracle-to-date.sql
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 Mar 8, 2013
Find the *public* IP of a host (got this from a handy StackExchange post)
View public-ip.sh
wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'
@theothermattm
theothermattm / gist:5277168
Created Mar 30, 2013
SLF4J Parameterized Logging Example
View gist:5277168
// 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 Jan 30, 2014
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
View node-stream-transform.js
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 Jan 30, 2014
Command line to change the git:// protocol to https:// for those behind a corporate firewall
View gist:8707598
git config --global url."https://".insteadOf git://
@theothermattm
theothermattm / gist:8740850
Last active Aug 29, 2015
Find out current octal permissions of a file for chmod-ing
View gist:8740850
# linux
stat -c %a FILE
# OS X
stat -f "%OLp" FILENAME
@theothermattm
theothermattm / gist:8743170
Created Jan 31, 2014
Get Oracle database name in a sql scrip
View gist:8743170
select sys_context('userenv','db_name') from dual;
@theothermattm
theothermattm / KeyAuthSetup.md
Last active Dec 19, 2016
Setting up keyauth fast
View KeyAuthSetup.md
  • 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 Feb 3, 2014
List java home directories on OS X
View gist:8793406
/usr/libexec/java_home -V