Skip to content

Instantly share code, notes, and snippets.

View thecodejunkie's full-sized avatar

Andreas Håkansson thecodejunkie

View GitHub Profile
@iMartyn
iMartyn / mini-port-forward.bash
Created December 20, 2017 17:34
Port-forward minikube ports to localhost ports
#!/bin/bash
MINIKUBE_IP=$(minikube ip)
MINIKUBE_KEY_LOCATION=${HOME}/.minikube/machines/minikube/id_rsa
STARTING_PORT=8080
CURRENT_PORT=${STARTING_PORT}
for servicename in $*; do
HIGH_PORT=$(kubectl get svc ${servicename} -o custom-columns=':spec.ports[*].nodePort' | tail -n1)
if echo $HIGH_PORT | grep -q ,; then
@elijahmanor
elijahmanor / agnoster.zsh-theme
Created November 21, 2017 14:05
Custom Agnoster Zsh Theme to Add Node & Npm Versions
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
# Make sure you have a recent version: the code points that Powerline
@goldshtn
goldshtn / analyze.py
Created March 4, 2017 15:22
.NET Core on Linux LLDB analysis scripts
#!/usr/bin/env python
#
# analyze.py Example of an LLDB script that loads SOS and runs a command
# for analysis of a .NET Core application on Linux/macOS.
# Requires LLDB matching the version of libsosplugin.so for your
# CoreCLR version, and gdb.
#
# USAGE: analyze.py [--memory] [--stacks] COREFILE
#
# NOTE: To run this as stand-alone, you might need to fix some bad symlinks
@jchannon
jchannon / info.md
Last active September 13, 2016 11:44
VSCode tasks.json for building, restoring, executing tests on OSX with .Net Core

Info

This will require OSX and ZSH installed.

For tests it will require your directory name to match your namespace for tests as it uses the directory name to pass the namespace to xunit

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
public class C
{
public async Task<IEnumerable<string>> M()
{
return await N();
}
$dontcare = git fetch origin --prune
$branches = git branch -a --merged |
?{$_ -match "remotes\/origin"} |
?{$_ -notmatch "\/master"} |
%{$_.Replace("remotes/origin/", "").Trim() }
if (-not $branches) {
echo "No merged branches detected"
exit 0
}
public IObservable<WebResponse> MakeWebRequest(
Uri uri,
Dictionary<string, string> headers = null,
string content = null,
int retries = 3,
TimeSpan? timeout = null)
{
var request = Observable.Defer(() =>
{
var hwr = WebRequest.Create(uri);
private static FakeNancyModule GenerateNewFakeNancyModuleType()
{
var typeName = String.Format("FakeNancyModule-" + Guid.NewGuid());
var assemblyName = new AssemblyName("NancyDynamic");
var assemblyBuilder = System.Threading.Thread.GetDomain().DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
var module = assemblyBuilder.DefineDynamicModule("NancyDynamicModule");
var builder = module.DefineType(typeName, TypeAttributes.Public, typeof(FakeNancyModule));
return Activator.CreateInstance(builder.CreateType());
}
@grumpydev
grumpydev / DefaultNancyBootStrapper.cs
Created January 17, 2011 12:50
Default types are now protected fields which, when the bootstrapper GetEngine is called, are turned into TRegisterType, TImplementation type combos which are then passed into the bootstrapper for the container to register. Changing a default implementatio
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TinyIoC;
using Nancy.BootStrapper;
using Nancy.Routing;
namespace Nancy
{