Skip to content

Instantly share code, notes, and snippets.

View m-x-k's full-sized avatar

Martin Kelly m-x-k

View GitHub Profile
@m-x-k
m-x-k / findFolderLike.go
Created July 30, 2017 13:23
Golang script to find folders with matching string
package main
import (
"os"
"log"
"path/filepath"
"strings"
)
func findFolderLike(dir string, match string) {
@m-x-k
m-x-k / StreamControllerExample.java
Created August 16, 2017 20:53
Spring MVC return output stream as response using lambda
import org.apache.commons.io.IOUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
@Controller
public class StreamControllerExample {
@m-x-k
m-x-k / installCertificate.sh
Created September 1, 2017 07:31
Install self signed certificate on debian machine
#!/bin/bash
if [ $# -eq 0 ]
then
echo "./installCertificate.sh <HOSTNAME> <PORT>"
exit
fi
HOSTNAME=$1
PORT=$2
@m-x-k
m-x-k / restEndointMethodResponseExample.go
Created September 5, 2017 20:33
Golang http request method alternative response
package main
import "net/http"
func main() {
mainMux := http.NewServeMux()
mainMux.HandleFunc("/speak", func(res http.ResponseWriter, req *http.Request) {
if req.Method == "GET" {
res.Write([]byte("Hello, World!\n"))
@m-x-k
m-x-k / StepsToSetupArtifactoryWithNpm
Last active December 3, 2022 04:51
Setting up JFrog artifactory for NPM
docker pull docker.bintray.io/jfrog/artifactory-oss:latest
docker run --name artifactory -d -p 8081:8081 docker.bintray.io/jfrog/artifactory-oss
# In browser open http://localhost:8081 and follow basic steps
# Add new remote repository: http://localhost:8081/artifactory/webapp/#/admin/repositories/remote
# URL: https://registry.npmjs.org
# RepositoryLayout: NPM default
# Add new virtual repository of type "Generic" using remote repository above
@m-x-k
m-x-k / jenkinsJobConsoleOutput.py
Last active January 5, 2024 08:37
Python script to help get jenkins job console output
#!/usr/bin/env python
import re
import argparse
import requests
jenkins_url = "https://localhost:8080"
# Add new jobs here:
jobs = {
@m-x-k
m-x-k / revealExample.html
Last active April 8, 2018 02:14
reveal.js example slides
<!-- -*- indent-tabs-mode:t; -*- -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>Reveal Example Slides</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<link rel="stylesheet" href="./reveal.js/css/reveal.css"/>
<link rel="stylesheet" href="./reveal.js/css/theme/night.css" id="theme"/>
</head>
@m-x-k
m-x-k / PYTHON_RESOURCES.md
Last active April 8, 2018 02:14
List of python resource websites

When it comes to python development it can be difficult to know which websites to focus on for the best up-to-date information. Below is a list of go-to websites for all the latest and greatest python information:

Finding resources/tips

Awesome Python

Python Guide

Python Module of the Week

@m-x-k
m-x-k / gist:35365758fd090cc5781a342a7dab2727
Created December 3, 2017 18:54
OpenShift not resolving hostnames nip.io
nip.io supports the use of wildcards when setting host ip addresses (e.g. *.nip.io)
Some routers do not support DNS for nip.io support. To fix set 8.8.8.8 and 8.8.4.4 as your DNS entry.
@m-x-k
m-x-k / setup-pip.py
Created December 22, 2017 07:49
PIP artifactory configuration
import os
import argparse
# Constants
PIP_HOST = "artifactory.my.domain.com"
PIP_URL = "http://%s/artifactory/api/pypi" % PIP_HOST
def setup_pypric(args):
fullpath = "%s/.pypirc" % args.userhome