Skip to content

Instantly share code, notes, and snippets.

View serbrech's full-sized avatar
🤙
Working from home

Stéphane Erbrech serbrech

🤙
Working from home
View GitHub Profile
@serbrech
serbrech / goplugins.go
Last active April 10, 2019 07:32
go plugins using a visitor pattern
package main
import (
"fmt"
)
// These interface define how core components can be visited by plugins
type AcceptNetworkPlugin interface {
Accept(plugin NetworkPlugin)
@serbrech
serbrech / docker-compose.yml
Created May 8, 2018 07:47
docker-compose for truffle dev environment
version: '3'
services:
node:
container_name: node
image: node:9.8.0-alpine
#build: truffle
volumes:
- ./dapp:/dapp
@serbrech
serbrech / template.json
Last active February 7, 2018 08:57
k8s-dns-relay-extension
{
"name": "Relay-DNS",
"type": "Microsoft.Resources/deployments",
"apiVersion": "[variables('apiVersionLinkDefault')]",
"dependsOn": [
"vmLoopNode"
],
"properties": {
"mode": "Incremental",
"templateLink": {
@serbrech
serbrech / BoxStarter.ps1
Last active August 11, 2017 15:22
My Boxstarter Script
# Initialize reboot log file
$reboot_log = "C:\installation.rbt"
if ( -not (Test-Path $reboot_log) ) { New-Item $reboot_log -type file }
$reboots = Get-Content $reboot_log
# Boxstarter options
$Boxstarter.RebootOk=$true # Allow reboots?
$Boxstarter.NoPassword=$false # Is this a machine with no login password?
$Boxstarter.AutoLogin=$true # Save my password securely and auto-login after a reboot
@serbrech
serbrech / blogfeed.js
Created March 3, 2017 12:25
make a list of blogposts based on a rss feed
function buildList(ulId, posts) {
var lis = posts.map(t => {
var li = document.createElement("li");
var link = document.createElement("a");
link.href = t.url;
link.appendChild(document.createTextNode(t.title));
li.appendChild(link);
return li;
});
foreach (var @event in events)
{
try
{
ApplyDynamic(@event);
}
catch (RuntimeBinderException runtimeBinder)
{
//if someone finds the way to extract the type out of that
throw new NotSupportedException($"The event type {@event.GetType().Name} is not supported by the model", runtimeBinder);
#WORKS
Function ListZip {
param(
[string]$zipfile
)
Add-Type -AssemblyName System.IO.Compression.FileSystem
$ziparchive = [System.IO.Compression.ZipFile]::OpenRead($zipfile)
$ziparchive.Entries | % { Write-Host $_.Name }
}
Script MsmqStoragePath
{
DependsOn = '[File]MSMQDirectories'
GetScript = {
$manager = Get-MsmqQueueManager
return @{
Result = $manager
GetScript = $GetScript
TestScript = $TestScript
SetScript = $SetScript
@serbrech
serbrech / gitconfig-git
Created November 13, 2015 08:39 — forked from stevenh512/gitconfig-git
URL rewriting in .gitconfig
# Use git and git+ssh instead of https
[url "git://github.com/"]
insteadOf = https://github.com/
[url "[email protected]:"]
pushInsteadOf = "git://github.com/"
[url "[email protected]:"]
pushInsteadOf = "https://github.com/"
public static MvcHtmlString CompassUrl(this HtmlHelper helper, string compassUrl)
{
//...
var anchorBuilder = new TagBuilder("a");
anchorBuilder.Attributes.Add("target", IsCompassContext(helper) ? "_parent" : "_blank");
anchorBuilder.Attributes.Add("href", compassUrl);
//...
}
private static bool IsCompassContext(HtmlHelper helper)