Skip to content

Instantly share code, notes, and snippets.


Matthew Setter settermjd

View GitHub Profile
settermjd /
Last active Apr 14, 2020
Examples of the same class in multiple c-based languages
class HelloWorld {
private String name;
public HelloWorld(String name) { = name;
public void printName() {
settermjd / download-file-in-expressive.php
Last active Mar 6, 2020
Quick example of how to download/stream a file using Zend Expressive.
View download-file-in-expressive.php
* This is a quick example of how to stream a file to a client, likely a browser,
* using Zend Expressive. There are a lot of factors which it doesn't take in to
* account. But for the purposes of a quick intro, this should suffice.
class ViewDocumentPageAction
protected function downloadFile()
settermjd / compact-child-routes
Created Apr 2, 2014
Simple example of using child routes, using the Segment type, to keep a routing table in Zend Framework 2 simple and compact. For more information, check out
View compact-child-routes
return array(
'router' => array(
'routes' => array(
'forecaster' => array(
'type' => 'Literal',
'options' => array(
'route' => '/forecaster',
'defaults' => array(
'__NAMESPACE__' => 'Forecaster\Controller',
'controller' => 'Forecaster',
settermjd /
Last active Jan 30, 2019
Bash one-liner to print a list of unique names in ownCloud apps
# Create a temporary file to store the results of the script
tmpfile=$(mktemp /tmp/dirnames.XXX);
# Print the directories found in each app directory
for i in $( ls . )
ls -A $i >> $tmpfile
# Sort and print a unique list of the discovered directories
settermjd / Dockerfile
Last active Jan 10, 2019
Custom owncloud-ubuntu Dockerfile
View Dockerfile
FROM owncloud/ubuntu:18.04
VOLUME ["/mnt/data"]
ENTRYPOINT ["/usr/local/bin/entrypoint"]
CMD ["/usr/local/bin/owncloud"]
settermjd / complexity-example.c
Created Jul 12, 2018
A small C program for the sakes of demonstrating cyclomatic complexity
View complexity-example.c
#include <stdio.h>
#include <time.h>
#include <string.h>
int main()
time_t t = time(NULL);
struct tm tm = *localtime(&t);
const char * months[12] = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
View zend-db-sql-join-example.php
// other setup code...
'id = ?' => $userId
['r' => 'tblroles'],
# Inspired by
if test "$1"; then
repo=`git remote -v | grep -m 1 "(push)" | sed -e "s/.*[:/]\(.*\)\.git.*/\1/"`
settermjd /
Created Feb 13, 2018
Script to backport a PR to branch (used mainly for working with the ownCloud documentation)
set -e
# Script to backport a PR to branch
# ./ backportTo backportFrom prId
# This script requires two other tools:
# - github-api-tools
# - git-backport
# add your GitHub credentials

Keybase proof

I hereby claim:

  • I am settermjd on github.
  • I am settermjd ( on keybase.
  • I have a public key ASAL6A3SHjLSE8X0cePFas3u7nE7xwlxHc4mxwkFNNj2ugo

To claim this, I am signing this object:

You can’t perform that action at this time.