Skip to content

Instantly share code, notes, and snippets.

@heardk
heardk / OneNote-to-MD.md
Last active June 24, 2024 07:16
Convert notes from OneNote into Markdown

Converting One Note to Markdown

This is an example of how to convert notes from OneNote into Markdown to use in other, less annoying Note applications. I am using PowerShell on Windows here, but other shell/scripting environments would work as well. If you want separate .md files, you'll need to export your OneNote pages separately. Exporting a section, or a selection of pages creates a single .docx file.

  • Download and install Pandoc
  • Export each of your note pages to a .docx (Word) format using OneNote export from the File menu
  • Gather all of these .docx files into a directory
  • Open directory in File Explorer
  • Open Powershell from the File Explorer using File -> Open Windows Powersell
  • Run the following command:
@mburbea
mburbea / Bits.cs
Last active February 24, 2019 12:51
namespace System {
// Little-Endian based approaches most likely do not work on big-endian hardware.
// Code based on examples found in
// Bit Twiddling hacks:
// https://graphics.stanford.edu/~seander/bithacks.html
// Chess programming wiki:
// https://chessprogramming.wikispaces.com/BitScan
public static class Bits
{
@nietras
nietras / CopiesBenchmark-report-github.md
Created August 7, 2016 17:43
Another .NET memory copy benchmark with more details
Host Process Environment Information:
BenchmarkDotNet=v0.9.8.0
OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i5-3475S CPU 2.90GHz, ProcessorCount=4
Frequency=2840373 ticks, Resolution=352.0664 ns, Timer=TSC
CLR=MS.NET 4.0.30319.42000, Arch=32-bit RELEASE
GC=Concurrent Workstation
JitModules=clrjit-v4.6.1080.0
@resilar
resilar / ctz.c
Created June 15, 2016 13:59
de Bruijn CTZ with proper handling of 0
// you faggots probably know the de bruijn trick to count trailing zeros:
inline int ctz32_retarded(uint32_t x)
{
static const unsigned char debruijn_ctz32[32] = {
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
};
return debruijn_ctz32[((x & -x) * 0x077CB531) >> 27];
}
@omnibs
omnibs / 101-rx-samples.md
Last active June 22, 2024 17:22
101 Rx Samples in C#

101 Rx Samples in C#

This was taken from http://rxwiki.wikidot.com/101samples, because I wanted to be able to read it more comfortable with syntax highlighting.

Here's the unedited original, translated to Github Markdown glory:

101 Rx Samples - a work in progress

@davidfowl
davidfowl / Example1.cs
Last active June 19, 2024 16:41
How .NET Standard relates to .NET Platforms
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)
using BenchmarkDotNet.Attributes;
using System;
namespace ConsoleApplication2
{
[Config("jobs=RyuJitX64")]
public class IndexOf
{
// Not found
[Params(1, 12, 50, 100, 200, 500)]
@alphapapa
alphapapa / mangle
Last active June 21, 2021 16:03
Mangle man pages to show just the parts you need (suitable for aliasing to "man")
#!/bin/bash
less_command='| less $less_no_init -aiF -Ps"Manual page\: $man_page (?ltline %lt?L/%L.:byte %bB?s/%s..? (END):?pB %pB\%..)"'
# Get section
if [[ $1 =~ [0-9]+ ]]
then
section=$1
shift
fi
// Classic C++ declaration order // Modern C++ style
const char* s = "Hello"; auto s = "Hello";
widget w = get_widget(); auto w = get_widget();
employee e{ empid }; auto e = employee{ empid };
widget w{ 12, 34 }; auto w = widget{ 12, 34 };
unique_ptr<widget> w auto w = make_unique<widget>();
= make_unique<widget>();
int x = 42; auto x = 42;
float x = 42.; auto x = 42.f;
@MichaelPote
MichaelPote / himawari.ps1
Created February 3, 2016 19:11
Windows Powershell Script to download the latest image from the Himawari-8 satelite, combine the tiles into a single image, convert to jpg and then set as the desktop background.
#
# Himawari-8 Downloader
#
#
#
# This script will scrape the latest image from the Himawari-8 satellite, recombining the tiled image,
# converting it to a JPG which is saved in My Pictures\Himawari\ and then set as the desktop background.
#
# http://himawari8.nict.go.jp/himawari8-image.htm
#