Skip to content

Instantly share code, notes, and snippets.

View Hades32's full-sized avatar
😬

Martin Rauscher Hades32

😬
View GitHub Profile
@Hades32
Hades32 / registry_test.exs
Created September 4, 2014 14:15
Problem with GenEvent.stream vs. GenEvent.add_handler
defmodule KV.RegistryTest do
use ExUnit.Case, async: true
alias KV.Registry, as: Reg
# test helper module
defmodule Forwarder do
use GenEvent
def handle_event(event, parent) do
send parent, event
@Hades32
Hades32 / PixelImageConverer.cs
Created January 15, 2011 16:57
How to get Nearest Neighbor image scaling working in Wilverlight or WP7
using System;
using System.Linq;
using System.Windows.Data;
using System.Windows.Media.Imaging;
namespace WPNearestNeighbor
{
public class PixelImageConverter : IValueConverter
{
/// <summary>
@Hades32
Hades32 / gist:1145013
Created August 14, 2011 15:59
Export (all) Visio pages as PDF
Sub expCurrent()
Call Application.ActiveDocument.ExportAsFixedFormat(visFixedFormatPDF, ActiveDocument.Path & "\Images\" & Application.ActivePage.Name & ".pdf", visDocExIntentPrint, visPrintCurrentPage)
End Sub
Sub expAll()
Dim p As Page
@Hades32
Hades32 / run.sh
Last active August 25, 2017 17:58
Start a docker container with environment variables for external port and IP
#!/bin/bash
#Start a docker container with environment variables for external port and IP
if [ -z $1 ]
then
echo pass in starting port
exit 1
fi
START_PORT=$1
@Hades32
Hades32 / fizzlefade.html
Last active December 30, 2017 13:51 — forked from edco/fizzlefade.html
add possibility to break (obvious) determinism
<!DOCTYPE html>
<html>
<head><title>Javascript RT</title></head>
<style>canvas {width: 1280px; height: 768px}</style>
<body>
<canvas id="framebuffer"></canvas>
<script type="text/javascript">
/* Fizzlefade using a Feistel network.
@Hades32
Hades32 / JwtSecurityConfig.kt
Created November 12, 2018 00:21
Handling JWT Validation with only RSA X.509 Public Key
package mn.max
import io.micronaut.context.annotation.Value
import io.micronaut.security.token.jwt.signature.rsa.RSASignatureConfiguration
import java.security.KeyFactory
import java.security.interfaces.RSAPublicKey
import java.security.spec.X509EncodedKeySpec
import java.util.*
import javax.inject.Named
import javax.inject.Singleton
@Hades32
Hades32 / main.go
Created October 19, 2019 22:36
Azure EventHub with Go experiment
package main
// MIT License
//
// Copyright (c) Martin Rauscher. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
@Hades32
Hades32 / fail.js
Created January 18, 2020 14:06
vodafone station endless loop
for(i=0 ; i<getdata['StaticNHostTable'].length ; i++) {
if(index != null) {
if(index == i) {
tt.find('span.inner-dropbox').text(getdata['StaticNHostTable'][i]['HostName']);
MAC = (getdata['StaticNHostTable'][i]['MAC']).split(":");
IP = (getdata['StaticNHostTable'][i]['IP']).split(".");
for(j=0; j<6; j++){
tt.find('.extra_mac_address'+(j+1)).text(MAC[j]);
}
@Hades32
Hades32 / 01-setup-system.network.sh
Created April 12, 2020 08:05
Grafana+Prometheus for home network monitoring
#!/bin/bash
docker network create mynet
useradd --system container-user
mkdir -p /data/prom/config/ /data/prom/data/ /data/grafana/data/ /data/meshping/redis/
chown -R container-user /data/prom/config/ /data/prom/data/ /data/grafana/data/ /data/meshping/redis/
@Hades32
Hades32 / kill.sh
Last active April 30, 2020 09:13
Instant k3s cluster on Scaleway
#!/bin/bash
set -euo pipefail
server_name=$1
region=${2:-"par1"}
function fix_scw {
# there is currently a bug in scw that causes failures when (re)using servernames with '-' in it
rm ~/.scw-cache.db || true
}