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 / ConEmuToCmd.fsx
Created April 21, 2017 12:39
Configure cmd.exe to use the same colors as the current theme configured in ConEmu
#r "System.Xml.Linq"
open System
open System.Text.RegularExpressions
open System.Xml.Linq
open System.Xml.XPath
open Microsoft.Win32
let convert () =
let doc = XDocument.Load(Environment.ExpandEnvironmentVariables(@"%APPDATA%\ConEmu.xml"))
@vbfox
vbfox / LuceneIndexEml.linq
Last active May 6, 2017 22:32
LINQPad script to index & search a folder full of .eml files
<Query Kind="Program">
<NuGetReference>HtmlAgilityPack</NuGetReference>
<NuGetReference>Lucene.Net</NuGetReference>
<NuGetReference>MimeKit</NuGetReference>
<Namespace>HtmlAgilityPack</Namespace>
<Namespace>Lucene.Net</Namespace>
<Namespace>Lucene.Net.Analysis</Namespace>
<Namespace>Lucene.Net.Analysis.Standard</Namespace>
<Namespace>Lucene.Net.Analysis.Tokenattributes</Namespace>
<Namespace>Lucene.Net.Documents</Namespace>
@vbfox
vbfox / msiexec.ps1
Created June 28, 2017 13:11
Finding where is an installed package msi file (Windows Installer)
get-wmiobject Win32_Product | Where-Object { $_.Name -like "*foo*" } | Format-Table Name, LocalPackage, PackageCache, PackageName, InstallSource
@vbfox
vbfox / config.json
Last active August 4, 2017 22:06
VS Code no editor decorations
{
"editor.folding": false,
"editor.lineNumbers": "off",
"editor.renderWhitespace": "none",
"editor.codeLens": false,
"editor.minimap.enabled": false,
"editor.dragAndDrop": false,
"editor.renderIndentGuides": false
}
@vbfox
vbfox / redux.tsx
Last active October 4, 2017 09:10
Redux with discriminated unions
import { List } from "immutable";
import * as React from "react";
import { connect } from "react-redux";
import { Action, Dispatch } from "redux";
export enum ActionKind {
AddTodo = "ADD_TODO",
RemoveTodo = "REMOVE_TODO"
}
{
"FSharp.lineLens.enabled": "replaceCodeLens",
"workbench.colorCustomizations": {
"editorCodeLens.foreground": "#4C4B4B"
},
"[fsharp]": {
"editor.codeLens": false
}
}
@vbfox
vbfox / TypedTaskDefinitionHelper.fs
Last active January 29, 2018 13:01
Allow to define FAKE targets with a syntax similar to Gulp tasks and typed !
/// Allow to define FAKE tasks with a syntax similar to Gulp tasks and using instances instead of strings
/// https://gist.github.com/vbfox/2eee346524d688af55ccc467e154e1b4
module BlackFox.TypedTaskDefinitionHelper
open Fake
open System
type TaskMetadata = {
name: string
dependencies: TaskInfo list
@vbfox
vbfox / teamcity_agent_dedicated_non_admin_user.cmd
Last active November 6, 2017 16:52
TeamCity agent upgrade with dedicated user account
REM When TC Agent is using a dedicated account that isn't admin it can update itself
REM To solve it it's enough to give the user full control of the service account
REM Install SubInAcl from https://www.microsoft.com/en-us/download/details.aspx?id=23510
REM For service TCBuildAgent
REM And user Domain\User
"c:\Program Files (x86)\Windows Resource Kits\Tools\subinacl" /service TCBuildAgent /GRANT=Domain\User=F
@vbfox
vbfox / AsyncIo.fs
Created November 20, 2017 20:47
Fable async node IO
module AsyncIO
let private readdir (dir: string): Promise<ResizeArray<string>> =
Promise.Create(fun resolve fail ->
Fs.readdir(U2.Case1 dir, fun err files ->
if isDefined err then fail.Invoke(err) else resolve.Invoke(U2.Case1 files)))
let private unlink (path: string): Promise<unit> =
Promise.Create(fun resolve fail ->
Fs.unlink(U2.Case1 path, fun err ->
if isDefined err then fail.Invoke(err) else resolve.Invoke(U2.Case1 ())))
@vbfox
vbfox / requestAnimationFrame.md
Created January 28, 2018 12:55
Experimentations with using requestAnimationFrame in fable elmish

If the Elmish state should be updated by the event but not the view a wrapper component might do:

[<Import("cloneElement", from="react")>]
let cloneElement(element: ReactElement, props: obj, [<ParamList>] children: obj) = jsNative

type RequestAnimationFrameState<'a> = {
    props: 'a
}