Skip to content

Instantly share code, notes, and snippets.

View neshmi's full-sized avatar

Matthew Vincent neshmi

View GitHub Profile
@neshmi
neshmi / kube_logout
Created March 24, 2018 15:04
Force kubectl to refresh auth
#!/usr/bin/env ruby
require 'yaml'
kube_config = File.join(ENV["HOME"],".kube","config")
yaml = YAML.load(File.open(kube_config))
current_context = yaml["current-context"]
index = yaml["users"].find_index{|user| user["name"] == current_context}
@neshmi
neshmi / docker-clean.sh
Created October 21, 2017 12:43
File to clean docker images, containers, and stop running containers
#!/usr/bin/env bash
set -e
STOP=0
CONTAINERS=0
IMAGES=0
while getopts ":sci" opt; do
case $opt in
s)
STOP=1
### Keybase proof
I hereby claim:
* I am neshmi on github.
* I am neshmi (https://keybase.io/neshmi) on keybase.
* I have a public key ASCNRfEtmzt7MsYaq1nrByh-ZDMX8vcYKw4k3NXjOK5xQwo
To claim this, I am signing this object:
@neshmi
neshmi / Images controller spec
Created May 21, 2015 16:30
rspec controller spec with two expectations on a lambda
subject(:post_image) { -> { post :create, location_id: location.id, reconstruction_id: reconstruction.id, image: {image: Rack::Test::UploadedFile.new(Rails.root.join('spec', 'fixtures', 'files', 'test1500white.png'), 'image/png') } } }
it { is_expected.to change(Image, :count).by(1) }
it { is_expected.to change(AssetRelation, :count).by(1) }
! @6l0h8k8c8 - Internal server error, for (GET) [/narthex/] ->
play.api.Application$$anon$1: Execution exception[[RuntimeException: java.lang.ExceptionInInitializerError]]
at play.api.Application$class.handleError(Application.scala:296) ~[com.typesafe.play.play_2.10-2.3.5.jar:2.3.5]
at play.api.DefaultApplication.handleError(Application.scala:402) [com.typesafe.play.play_2.10-2.3.5.jar:2.3.5]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:205) [com.typesafe.play.play_2.10-2.3.5.jar:2.3.5]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$14$$anonfun$apply$1.applyOrElse(PlayDefaultUpstreamHandler.scala:202) [com.typesafe.play.play_2.10-2.3.5.jar:2.3.5]
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33) [org.scala-lang.scala-library-2.10.4.jar:na]
Caused by: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at play.api.mvc.ActionBuilder$$anon$1.apply(Action.scala:523)
@neshmi
neshmi / _.md
Created September 11, 2013 14:33
rebinding data lvl 2
@neshmi
neshmi / _.md
Created September 10, 2013 03:50
stratifier
@neshmi
neshmi / _.md
Created September 4, 2013 21:31
none
var map, squares, fieds, objects, tiled;
// pink tile avoidance
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5;
// make OL compute scale according to WMS spec
OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;
function init(){
format = 'image/png';
<script language="Javascript">
function formSubmitted(){
if (navigator.userAgent.indexOf( 'Safari' ) != -1) {
setTimeout ( "resubmitForm()", 2000 );
}
}
function resubmitForm() {
document.new_image.submit();
}