Skip to content

Instantly share code, notes, and snippets.

View derekbassett's full-sized avatar

Derek Bassett derekbassett

View GitHub Profile
@derekbassett
derekbassett / .bashrc
Created January 30, 2020 18:41
using strace on multiple processes in linux
function straceall {
sudo strace -f $(pidof "${1}" | sed 's/\([0-9]*\)/-p \1/g')
}
@derekbassett
derekbassett / exploit-for-docker-containers.md
Created November 28, 2018 05:14
Potential exploit for Docker Containers

Step 1. Launch a docker container

    $ docker run -it ubuntu /bin/bash

Step 2. Run the following INSIDE the container

    $ export LOCATION="SFS in Denver"
    $ sleep 1000

Step 3. Run outside the container in another window at the same time

@derekbassett
derekbassett / pom-child.xml
Last active October 20, 2017 18:42
Using com.spotify:dockerfile-maven-plugin with multi-project poms.
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<configuration>
<repository>${docker.registry}/${docker.image}</repository>
<tag>${docker.tag}</tag>
<buildArgs>
<JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
<skip>${dockerfile.skip}</skip>
@derekbassett
derekbassett / gist:c4cb100b8ec8555682d67b2338f2c669
Created February 25, 2017 16:57 — forked from abesto/gist:3476594
Go: Newton's method for square root
/*
A Tour of Go: page 44
http://tour.golang.org/#44
Exercise: Loops and Functions
As a simple way to play with functions and loops, implement the square root function using Newton's method.
In this case, Newton's method is to approximate Sqrt(x) by picking a starting point z and then repeating: z - (z*z - x) / (2 * z)
@derekbassett
derekbassett / ExampleApplication.java
Created March 6, 2016 18:53
An example of using Jersey's dependency injection framework in a DropWizard application.
package io.github.derekbassett.exampledropwizard
import com.mongodb.MongoClient;
import io.dropwizard.Application;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.glassfish.hk2.utilities.binding.AbstractBinder;
@derekbassett
derekbassett / gist:99f7d496370b1f21af9e
Created May 17, 2015 05:25
Debugging Data Contexts in Meteor
Alternatively, if you need to find out more about the data context of a specific template fragment, you can also write a dedicated {{log}} helper:
Template.profile.helpers({
log: function () {
console.log(this);
}
});
And use it directly in your templates:
<template name="profile">
@derekbassett
derekbassett / Main.java
Created November 13, 2014 17:32
Simple instructions on how to add an Async Servlet to an Embedded Tomcat
public class Main {
private static final int PORT = 8085;
public static void main(String args[]){
Tomcat server = new Tomcat();
server.setPort(PORT);
Context ctx = server.addContext("/ctx0", new File(".").getAbsolutePath());
Wrapper wrapper = Tomcat.addServlet(ctx, "MyAsyncServlet", new MyAsyncServlet());