Skip to content

Instantly share code, notes, and snippets.

Avatar

Ion Mincu dburner

View GitHub Profile
@dburner
dburner / EvilStringHelper.cs
Created Mar 12, 2018 — forked from dtao/EvilStringHelper.cs
Devious C# class that makes .NET strings mutable without requiring the /unsafe compiler switch
View EvilStringHelper.cs
public static class EvilStringHelper
{
private static readonly Action<string, int, char> _setChar;
private static readonly Action<string, int> _setLength;
static EvilStringHelper()
{
if (Environment.Version.Major < 4)
{
MethodInfo setCharMethod = typeof(string).GetMethod(
@dburner
dburner / gist:77bbdcaa5338d1859bb8caa88bdf2b6a
Created Sep 18, 2017 — forked from kyledrake/gist:d7457a46a03d7408da31
Creating a self-signed SSL certificate, and then verifying it on another Linux machine
View gist:77bbdcaa5338d1859bb8caa88bdf2b6a
# Procedure is for Ubuntu 14.04 LTS.
# Using these guides:
# http://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/
# https://turboflash.wordpress.com/2009/06/23/curl-adding-installing-trusting-new-self-signed-certificate/
# https://jamielinux.com/articles/2013/08/act-as-your-own-certificate-authority/
# Generate the root (GIVE IT A PASSWORD IF YOU'RE NOT AUTOMATING SIGNING!):
openssl genrsa -aes256 -out ca.key 2048
openssl req -new -x509 -days 7300 -key ca.key -sha256 -extensions v3_ca -out ca.crt
@dburner
dburner / 00-intro.md
Created Sep 6, 2017 — forked from mdo/00-intro.md
Instructions for how to affix an Ikea Gerton table top to the Ikea Bekant sit-stand desk frame.
View 00-intro.md

Ikea Bekant standing desk with Gerton table top

@dburner
dburner / gist:b8b219722ade9a1831e56e7bf00239cf
Created May 25, 2017 — forked from mtigas/gist:952344
Mini tutorial for configuring client-side SSL certificates.
View gist:b8b219722ade9a1831e56e7bf00239cf

Client-side SSL

For excessively paranoid client authentication.

Using self-signed certificate.

Create a Certificate Authority root (which represents this server)

Organization & Common Name: Some human identifier for this server CA.

openssl genrsa -des3 -out ca.key 4096
openssl req -new -x509 -days 365 -key ca.key -out ca.crt
@dburner
dburner / attention_lstm.py
Created May 19, 2017 — forked from mbollmann/attention_lstm.py
My attempt at creating an LSTM with attention in Keras
View attention_lstm.py
class AttentionLSTM(LSTM):
"""LSTM with attention mechanism
This is an LSTM incorporating an attention mechanism into its hidden states.
Currently, the context vector calculated from the attended vector is fed
into the model's internal states, closely following the model by Xu et al.
(2016, Sec. 3.1.2), using a soft attention model following
Bahdanau et al. (2014).
The layer expects two inputs instead of the usual one:
@dburner
dburner / EFExtensions.cs
Created May 5, 2017 — forked from ondravondra/EFExtensions.cs
C# extension for executing upsert (MERGE SQL command) in EF with MSSQL
View EFExtensions.cs
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
namespace EFExtensions
@dburner
dburner / keras_attention_wrapper.py
Created Apr 26, 2017 — forked from rilut/keras_attention_wrapper.py
A keras attention layer that wraps RNN layers.
View keras_attention_wrapper.py
"""
A keras attention layer that wraps RNN layers.
Based on tensorflows [attention_decoder](https://github.com/tensorflow/tensorflow/blob/c8a45a8e236776bed1d14fd71f3b6755bd63cc58/tensorflow/python/ops/seq2seq.py#L506)
and [Grammar as a Foreign Language](https://arxiv.org/abs/1412.7449).
date: 20161101
author: wassname
url: https://gist.github.com/wassname/5292f95000e409e239b9dc973295327a
"""
@dburner
dburner / cnn_rnn_model.py
Created Mar 18, 2017 — forked from mtreviso/cnn_rnn_model.py
Variable sentence size CNN + RNN with Keras
View cnn_rnn_model.py
# vocabulary = OrderedDict()
input_length = None
vocabulary_size = max(vocabulary.values()) + 1
weights_w2v = list(map(Word2Vec.__getitem__, vocabulary.keys()))
embedding_size len(weights_w2v[0])
nb_classes = 5
# CNN hyperparms
nb_filter = 64
filter_length = 5
@dburner
dburner / Example1.cs
Created Dec 19, 2016 — forked from davidfowl/Example1.cs
How .NET Standard relates to .NET Platforms
View Example1.cs
namespace Analogy
{
/// <summary>
/// This example shows that a library that needs access to target .NET Standard 1.3
/// can only access APIs available in that .NET Standard. Even though similar the APIs exist on .NET
/// Framework 4.5, it implements a version of .NET Standard that isn't compatible with the library.
/// </summary>INetCoreApp10
class Example1
{
public void Net45Application(INetFramework45 platform)
View angular2.jspm.md

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

You can’t perform that action at this time.