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;
});
@serbrech
serbrech / roundhouse.ps1
Last active February 9, 2017 14:01
Powershell roundhouse wrapper
function Invoke-Roundhouse {
param(
[alias("env")]$environment="LOCAL",
$server="(local)",
$dbName="DB"
)
$scriptPath = Split-Path (Get-PSCallStack)[1].ScriptName
write-host "base path : $scriptPath"
$sql_files_directory= Join-Path $scriptPath "db\DBScriptFolder"
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 / MsDeploy.ps1
Created December 17, 2013 11:57
Powershell wrapper around msdeploy.exe
function DeployWebsite($Package, $Server, $IISSite, $App, $Username, $Password) {
$MSDeployKey = 'HKLM:\SOFTWARE\Microsoft\IIS Extensions\MSDeploy\3'
if(!(Test-Path $MSDeployKey)) {
throw "Could not find MSDeploy. Use Web Platform Installer to install the 'Web Deployment Tool' and re-run this command"
}
$InstallPath = (Get-ItemProperty $MSDeployKey).InstallPath
if(!$InstallPath -or !(Test-Path $InstallPath)) {
throw "Could not find MSDeploy. Use Web Platform Installer to install the 'Web Deployment Tool' and re-run this command"
}