Skip to content

Instantly share code, notes, and snippets.

canton7 / gist:1053846
Created Jun 29, 2011
git push, tracking, and push.default
View gist:1053846

git clone path/to/test/repo.git

push.default = matching (the default)

git config push.default matching

git branch -a
   * master
canton7 / RSAConverter.cs
Last active Jul 1, 2022
C# class to convert OpenSSL private keys into PuTTY'-format private keys. Can't handle encryption or anything else funky
View RSAConverter.cs
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
// Usage:
canton7 /
Last active Jun 11, 2022
Local versions of tracked config files

How to have local versions of tracked config files in git

This is a fairly common question, and there isn't a One True Answer.

These are the most common techniques:

If you can modify your application

View GlobalKeyboardHook.cs
public class GlobalKeyboardHook : IDisposable
private delegate IntPtr LowLevelKeyboardProc(int nCode, int wParam, IntPtr lParam);
private const int WH_KEYBOARD_LL = 13;
private const int WM_KEYDOWN = 0x0100;
private const int WM_KEYUP = 0x0101;
private const int VK_SHIFT = 0x10;
private const int VK_CONTROL = 0x11;
canton7 / Setup.iss
Last active Sep 17, 2021
Installing .NET Framework 4.6.1 with Inno Setup
View Setup.iss
#define DotNetRuntimeExe "NDP461-KB3102436-x86-x64-AllOS-ENU.exe"
InstallingDotNetFramework=Installing .NET Framework. This might take a few minutes...
DotNetFrameworkFailedToLaunch=Failed to launch .NET Framework Installer with error "%1". Please fix the error then run this installer again.
DotNetFrameworkFailed1602=.NET Framework installation was cancelled. This installation can continue, but be aware that this application may not run unless the .NET Framework installation is completed successfully.
DotNetFrameworkFailed1603=A fatal error occurred while installing the .NET Framework. Please fix the error, then run the installer again.
DotNetFrameworkFailed5100=Your computer does not meet the requirements of the .NET Framework. Please consult the documentation.
DotNetFrameworkFailedOther=The .NET Framework installer exited with an unexpected status code "%1". Please review any other messages shown by the installer to determine whether the installation completed successfully, and abort this
View ##java takeover.txt
14:50 *** @ChanServ has changed the topic to: Welcome to ##java. Freenode community channel for java. Please keep it civil and dont spam or be political.
14:55 <cheeser> the fuck?
14:56 <cheeser> so i guess ##java has officially been hijacked by our new overlords.
14:59 <dreamreal> I wonder what the trigger was.
15:00 <dreamreal> Did they notify you at all?
15:02 <cheeser> not at all
15:03 <cheeser> so for the rest of you still here good luck. if you want something active, we're all at libera.
15:04 <dreamreal> Java has been taken over by freenode staff, given that they weren't acting as if they deserved to be trusted, and then acted upon that distrust. The old ops have set up shop in #java on If you want, join us there. if not, cool beans.
15:05 <@sorcerer> actually you guys failed to deal with spam thats what brought me here
15:06 <Maldivia> considering there has been no spam here, that's rich
View git-ffwd.pdf
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View ReactiveExtensionsExtensions.cs
public static class ReactiveExtensionsExtensions
public static async Task SubscribeAsync<T>(this IObservable<T> observable, Action<T> onNext, CancellationToken? cancellationToken = null)
CancellationToken token = cancellationToken ?? CancellationToken.None;
var cts = new TaskCompletionSource<bool>();
using(token.Register(() => cts.SetCanceled()))
observable.Subscribe(onNext, ex => cts.SetException(ex), () => cts.SetResult(true), token);
await cts.Task;
canton7 /
Created Jan 6, 2012
Workflows for long-running feature branches

Workflows for long-running feature branches

These examples were created during a discussion with j416 on #github about how best to manage long-running feature branches.

The scenario is this: You have a long-running feature branch, based off master. The feature branch and master both touch the same parts of the same files, so you know that there will be conflicts when you finally merge the feature branch in. What can you do to minimise the conflicts?

View Installing LaTeX and

Installing LaTeX + TeXstudio

  1. Grab MiKTeX 2.9 and install. It doesn't really matter whether you get the complete or basic system, as the basic system will download packages as needed.
  2. Grab TeXstudio and install.
  3. Fire up TeXstudio and hit Options -> Configure TexStudio.
  4. Under "Commands", change "Bibtex" from "bibtex %" to "bibtex8 %" (bibtex8 is later and greater and is needed for biblatex, which is better than bibtex for reference handling).
  5. Under "Quick Build", check "PdfLaTeX + Ldf Viewer". Not all LaTeX compilers were created equal, and Pdf is likely the format you'll want.
  6. If you're feeling adventurous, go to "Editor" and change the font family to "Consolas" :)