Skip to content

Instantly share code, notes, and snippets.

Derek Bassett derekbassett

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

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 Oct 20, 2017
Using com.spotify:dockerfile-maven-plugin with multi-project poms.
View pom-child.xml
<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 Feb 25, 2017 — forked from abesto/gist:3476594
Go: Newton's method for square root
View gist:c4cb100b8ec8555682d67b2338f2c669
/*
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 Mar 6, 2016
An example of using Jersey's dependency injection framework in a DropWizard application.
View ExampleApplication.java
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
Debugging Data Contexts in Meteor
View gist:99f7d496370b1f21af9e
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 Nov 13, 2014
Simple instructions on how to add an Async Servlet to an Embedded Tomcat
View Main.java
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());
You can’t perform that action at this time.