Skip to content

Instantly share code, notes, and snippets.

View vbfox's full-sized avatar
❄️
Winter is coming

Julien Roncaglia vbfox

❄️
Winter is coming
View GitHub Profile
@vbfox
vbfox / debian-java-make-jpkg.sh
Last active November 4, 2017 20:56
Oracle java package generation for debian
echo "deb http://http.debian.net/debian/ jessie main contrib" | sudo tee -a /etc/apt/sources.list.d/contrib.list
sudo apt-get update && sudo apt-get install java-package libgl1-mesa-glx libxtst6 libxxf86vm1
wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.tar.gz
make-jpkg jdk-8u45-linux-x64.tar.gz
sudo dpkg -i oracle-java8-jdk_8u45_amd64.deb
@vbfox
vbfox / putty_ssh.reg
Created July 8, 2015 14:34
Open putty on ssh links
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ssh]
@="URL:SSH Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\ssh\shell]
[HKEY_CLASSES_ROOT\ssh\shell\open]
@vbfox
vbfox / EnumerableBatch.cs
Last active August 29, 2015 14:24
Linq IEnumerable batching
// Variant of MoreLinq Batch implementation
// https://code.google.com/p/morelinq/source/browse/MoreLinq/Batch.cs
public static IEnumerable<IEnumerable<T>> Batch<T>(IEnumerable<T> source, int size)
{
T[] bucket = null;
var count = 0;
foreach (var item in source)
{
@vbfox
vbfox / EwsExtensions.cs
Last active August 29, 2015 14:24
Utilities for Exchange Webservice
static class EwsExtensions
{
public static string GetFullPath(this Folder folder, string separator = "/")
{
var folderPathProperty = new ExtendedPropertyDefinition(26293, MapiPropertyType.String);
var folderPathPropertySet = new PropertySet(BasePropertySet.FirstClassProperties) { folderPathProperty };
var folderWithFullnameProperty = Folder.Bind(folder.Service, folder.Id, folderPathPropertySet);
object pathObj = null;
if (!folderWithFullnameProperty.TryGetProperty(folderPathProperty, out pathObj))
@vbfox
vbfox / es_shield.md
Last active August 29, 2015 14:24
Using ElasticSerarch shield to secure inter-node communications

Using ElasticSerarchshield to secure inter-node communications

All is from a cygwin console like Babun under windows.

CA certificate creation

openssl genrsa -des3 -out root-ca.key 2048
@vbfox
vbfox / CreateRelativePath.cs
Last active March 21, 2023 07:31
Make a path relative in C# and F#
using System;
using System.IO;
static class RelativePath
{
private static string[] GetPathPart(string path)
{
return path
.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar)
.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
@vbfox
vbfox / buildx.fsx
Last active December 14, 2016 15:57
Launching a scriptcs .csx file from FAKE
#r @"packages/FAKE/tools/FakeLib.dll"
#load "./scriptcs.fsx"
open Fake
open Fake.AssemblyInfoFile
open Fake.ReleaseNotesHelper
open System
open System.IO
open Fake.ScriptCs
@vbfox
vbfox / ExtractNestedClassesToSeparateFiles.fs
Last active November 3, 2015 00:00
Extract nested classes/struct/enums to their own files
open Microsoft.CodeAnalysis
open Microsoft.CodeAnalysis.CSharp
open Microsoft.CodeAnalysis.CSharp.Syntax
open Microsoft.CodeAnalysis.MSBuild
open Microsoft.CodeAnalysis.Formatting
open System.IO
module FluentRoslynLite =
let (!!) t = Async.AwaitTask t
let emptyFile = SyntaxFactory.CompilationUnit()
@vbfox
vbfox / fixupDotCoverArgs.fs
Last active January 20, 2016 14:34
Fix dotcover args in FAKE to be correctly passed to CreateProcess
/// Escape arguments in a form that programs parsing it as Microsoft C Runtime will successfuly understand
/// Rules taken from http://www.daviddeley.com/autohotkey/parameters/parameters.htm#WINARGV
module MsvcrCommandLine =
open System.Text
let escapeArg (arg : string) (builder : StringBuilder) =
let needQuote = arg.Contains(" ") || arg.Contains("\t")
let rec escape (builder: StringBuilder) pos =
if pos >= arg.Length then
()
@vbfox
vbfox / TaskDefinitionHelper.fsx
Last active September 8, 2017 08:19
Allow to define FAKE targets with a syntax similar to Gulp tasks
#r "packages/FAKE/tools/FakeLib.dll"
namespace BlackFox
/// Allow to define FAKE tasks with a syntax similar to Gulp tasks
[<AutoOpen>]
module TaskDefinitionHelper =
open Fake
open System
open System.Text.RegularExpressions