Skip to content

Instantly share code, notes, and snippets.

@JurrianFahner
JurrianFahner / progPrinciple.txt
Created April 18, 2016 13:20
some interesting programming principles
DRY -> Don't repeat yourself!
YAGNI -> You aren't gonna need it (yet)
SRP -> Single Responsibility Principle (code does one thing, and only one thing very well)
watch <command>
@JurrianFahner
JurrianFahner / jsonPostRequest.sh
Last active October 16, 2015 21:00
curl post data json
curl --silent -i -H "Content-Type: application/json" -X POST -d "{\"json\": {\"data\":\"here\"}}" http://theurl.com/to/post/to | tail -n 1 | python -m json.tool
@JurrianFahner
JurrianFahner / DNSLookup.java
Created October 9, 2015 12:47
A java class to find the specifics of a given hostname
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* DNSLookup is a class which demonstrates several features of <a href="http://docs.oracle.com/javase/7/docs/api/java/net/InetAddress.html">java.net.InetAddress</a>
* @author Jurrian Fahner
*/
public class DNSLookup {
@JurrianFahner
JurrianFahner / test nginx
Created June 26, 2015 12:24
Test nginx configuration
/usr/sbin/nginx -t -c /etc/nginx/nginx.conf
@JurrianFahner
JurrianFahner / createCertificate.sh
Created June 25, 2015 19:15
A simple script to create an csr for a SSL certificate request. Only thing a user must do is to adapt the dommainname and answer the questions asked.
#!/bin/bash
domainname="www.dommainname.com"
namekeyfile="$domainname.key"
namecsrfile="$domainname.csr"
# first create a private key
openssl genrsa -out $namekeyfile 2048
@JurrianFahner
JurrianFahner / jsonInspectDocker.py
Last active August 29, 2015 14:23
Python inspect on all containers
#!/usr/bin/python
from subprocess import *
#get all numeric IDs of active containers
allActiveContainers = Popen(["docker", "ps", "-q"], stdout=PIPE).communicate()[0]
#run the inspect on all active containers to produce one json file
check_call(["docker", "inspect"] + allActiveContainers.strip().split('\n'))