Skip to content

Instantly share code, notes, and snippets.

Avatar

Marcus Hammarberg marcusoftnet

View GitHub Profile
@marcusoftnet
marcusoftnet / demo.sh
Created Aug 26, 2021
Bash challenge from real life - part I; which licenses are used in all our code, including dependencies
View demo.sh
#!/usr/bin/env zsh
# The challenge is to understand which licenses we are indirectly including, by just getting a list of tool and license
# I'm thinking to post process this later, summarizing, sorting and aggregating in Google Sheets.
# For now I just want to get a list
# This assumest that all relevant repositories to be local directory in the current folder.
## Part I - install all dependencies for all repositories (i.e. all subfolders one level deep from .)
View marcus.yaml
# Employee records
- martin:
name: Martin D'vloper
job: Developer
skills:
- python
- perl
- pascal
- tabitha:
name: Tabitha Bitumen
View exampleEvent.json
{
"context" : {
"path" : "/user",
"method" : "POST"
},
"userId": "123",
"name": "Marcus Hammarberg",
"age": "43"
}
View anAttemptToResolve.js
/*global require, module*/
var ApiBuilder = require('claudia-api-builder'),
api = new ApiBuilder(),
Promise = require('bluebird');
module.exports = api;
// use a promise for asynchronous processing
api.get('/greet/{name}', function(request) {
'use strict';
View test.config.js
var should = require("should");
describe("Configuration", function() {
var validateConfig = function(config) {
should.exists(config.mode);
config.mode.should.not.be.emtpy;
should.exists(config.mongoUrl);
config.mongoUrl.should.not.be.emtpy;
View config
var mongoProdUri = process.env.MONGOLAB_URI || 'localhost:27017/myApp_Prod';
var adminUser = {
name : process.env.BASIC_USER || 'marcus',
pass : process.env.BASIC_PASS || 'koavote'
};
var config = {
local: {
mode: 'local',
@marcusoftnet
marcusoftnet / scaffold_post
Last active Jul 7, 2016
Jekyll Post Scaffolder
View scaffold_post
#!/bin/bash
#---------/---------------------\---------#
#--------|- Jekyll Post Creator -|--------#
#---------\---------------------/---------#
# Ripped and tweaked from https://gist.github.com/kabrooski/6107707
# Simply put the script in your site directory, edit the configs to fit your setup, and run it with:
# ./post "post title"
@marcusoftnet
marcusoftnet / makeReleaseNumber
Created Jun 19, 2014
function for setting next release number
View makeReleaseNumber
BIN = ./node_modules/.bin
define release
VERSION=`node -pe "require('./package.json').version"` && \
NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \
node -e "\
var j = require('./package.json');\
j.version = \"$$NEXT_VERSION\";\
var s = JSON.stringify(j, null, 2);\
require('fs').writeFileSync('./package.json', s);" && \
@marcusoftnet
marcusoftnet / maketestkoa
Created Jun 19, 2014
Makefile test task for Koa and Mocha
View maketestkoa
BIN = ./node_modules/.bin
.PHONY: test
test:
@$(BIN)/mocha \
--harmony-generators \
-u bdd \
-R dot \
-b
View makefileKwitansi
BIN = ./node_modules/.bin
define release
VERSION=`node -pe "require('./package.json').version"` && \
NEXT_VERSION=`node -pe "require('semver').inc(\"$$VERSION\", '$(1)')"` && \
node -e "\
var j = require('./package.json');\
j.version = \"$$NEXT_VERSION\";\
var s = JSON.stringify(j, null, 2);\
require('fs').writeFileSync('./package.json', s);" && \