Skip to content

Instantly share code, notes, and snippets.

@toburger
toburger / C++ and Qt.md
Last active May 5, 2019 21:40
information and ideas...

C++ and Qt

General advice

  • [C++] prefer expressions over statements
  • [C++] prefer immutability over mutability
  • [C++] prefer composition over inheritance
  • [Qt] prefer STL over QTL containers

Libraries

@toburger
toburger / prompt.ps1
Last active March 16, 2019 11:16 — forked from kadet1090/prompt.ps1
PowerLine like prompt for PowerShell
$script:bg = [Console]::BackgroundColor;
$script:first = $true;
$script:last = 0;
function Write-PromptFancyEnd {
Write-Host  -NoNewline -ForegroundColor $script:bg
$script:bg = [System.ConsoleColor]::Black
}
#I __SOURCE_DIRECTORY__
#r "libs/NuGet.Core.dll"
#r "System.Xml.Linq"
open NuGet
open System
open System.IO
module NuGet =
param ([string[]]$Computer = ".")
@($Computer) | % {
$c = $_
if ($c -eq '.') { $c = $env:COMPUTERNAME }
$os = get-wmiobject Win32_OperatingSystem -Computer $_
$physical = Get-WmiObject CIM_PhysicalMemory -Computer $_
$free = $os.FreePhysicalMemory
@toburger
toburger / build.fsx
Last active May 15, 2017 08:36
Use fsc 4.x to compile your code
//...
let fscToolPath = findToolFolderInSubPath "fsc.exe" "packages"
let msbuildProps = [ "FscToolPath", fscToolPath ]
Target "Build" (fun _ ->
!! projectFile
|> MSBuildReleaseExt releaseDir msbuildProps "Build"
|> Log "AppBuild-Output")
@toburger
toburger / keyboard_speed_settings.reg
Created March 27, 2017 07:58
Keyboard speed settings
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Accessibility\Keyboard Response]
"AutoRepeatDelay"="250"
"AutoRepeatRate"="13"
"BounceTime"="0"
"DelayBeforeAcceptance"="0"
"Flags"="59"
"Last BounceKey Setting"=dword:00000000
"Last Valid Delay"=dword:00000000
(*
ParserLibrary.fsx
Final version of a parser library.
Related blog post: http://fsharpforfunandprofit.com/posts/understanding-parser-combinators-3/
*)
module ParserLibrary
(*
JsonParser.fsx
A JSON parser built from scratch using a combinator library.
Related blog post: http://fsharpforfunandprofit.com/posts/understanding-parser-combinators-4/
*)
module JsonParser
/// Removes Diacritics (tilde, cédille, umlaut and friends) from String
let removeDiacritics (s: string) =
s.Normalize(NormalizationForm.FormD)
|> Seq.filter (fun c -> CharUnicodeInfo.GetUnicodeCategory c <> UnicodeCategory.NonSpacingMark)
|> Seq.fold (fun (sb: StringBuilder) c -> sb.Append c) (StringBuilder())
|> string
/// <summary>Removes Diacritics (tilde, cédille, umlaut and friends) from String</summary>
public static string RemoveDiacritics(this string s)
{
string normalizedString = s.Normalize(NormalizationForm.FormD);
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < normalizedString.Length; i++)
{
char c = normalizedString[i];
if (CharUnicodeInfo.GetUnicodeCategory(c) != UnicodeCategory.NonSpacingMark)