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 .)
@marcusoftnet
marcusoftnet / TinyIoCAndWCF
Created Jul 12, 2011
An implementation to get IoC support for WCF Services using TinyIoC (shamelessly stealing from Jimmy Bogard :))
View TinyIoCAndWCF
using System;
using System.Collections.ObjectModel;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
/*
* This is an TinyIoC implemention of the example in the excellent blog post by Jimmy Boggard
View marcus.yaml
# Employee records
- martin:
name: Martin D'vloper
job: Developer
skills:
- python
- perl
- pascal
- tabitha:
name: Tabitha Bitumen
@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"
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';
@marcusoftnet
marcusoftnet / config.js
Created Apr 21, 2014
simpleConfigobject
View config.js
var mongoDevUri = process.env.MONGOHQ_URL || "localhost:27017/koaVote_Dev";
var mongoStageUri = process.env.MONGOHQ_URL || "localhost:27017/koaVote_Test";
var mongoProdUri = process.env.MONGOHQ_URL || "localhost:27017/koaVote_Prod";
var config = {
local: {
mode: 'local',
port: 3000,
mongoUrl: mongoDevUri
},
View createHotspot.bat
netsh wlan set hostednetwork ssid=[your network name here] key=[your password here]
netsh wlan start hostednetwork
View TestingViewFactory.cs
using Nancy;
using Nancy.Testing;
using Nancy.ViewEngines;
namespace ItemVariants.Admin.Tests.Utils
{
// From http://melinder.se/blog/2012/02/nancytesting-intercept-the-model-sent-to-a-view/
public class TestingViewFactory : IViewFactory
{
View installDevApps.ps1
@powershell -NoProfile -ExecutionPolicy unrestricted -Command
"iex ((new-object net.webclient).DownloadString('https://raw.github.com/marcusoftnet/ScriptsAndStuff/master/devApps.ps1'))"