Skip to content

Instantly share code, notes, and snippets.

View kbilsted's full-sized avatar
💭
AFK most of the time...

Kasper B. Graversen kbilsted

💭
AFK most of the time...
View GitHub Profile
@kbilsted
kbilsted / PullOrCloneAll
Last active June 11, 2022 14:51
Clone or pull all repo's of a user - only repos with no changes and on "master" branch are updated
# remember to change the $gitHubApiKey
# remember to change the $uri username
$git="C:\Program Files\Git\bin\git.exe"
$gitHubApiKey = convertto-securestring "ghp_sdafsdfsdaf..." -asplaintext -force
function PullOrCloneAll($path="c:\src")
{
cd $path
Call `COMMAND` on all `.foo` files and output it to `.bar` files.
dir *.foo | foreach-object { $newname = $_.Name.Remove($_.Name.Length - $_.Extension.Length) + ".bar"; COMMAND -vn -n -i "$_" $newname }
@kbilsted
kbilsted / gitafterstats.cs
Created April 16, 2019 09:53
A simple program to parse git logs and produces change statistics grouped by month
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
namespace gitafterstat
{
/// <summary>
@kbilsted
kbilsted / ExtractColumToFiles.cs
Created October 18, 2017 13:17
extract column values to files
class Program
{
static void Main(string[] args)
{
var xml = GetXmlData();
WriteToFiles(xml, "xml");
var xsd = GetXsdData();
WriteToFiles(xsd, "xsd");
}
using System;
using System.Linq;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
namespace CSharpCompression
{
class Program
{
@kbilsted
kbilsted / doubleclick_with_keyboard.ahk
Created May 27, 2016 09:11
AutoHotkey: Double-click using the 1/2 key in the upper left corner rather than using the mouse button - to reduce RSI
½::Click 2
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
namespace MarkDownTableReformatter
{
class Program
{
@kbilsted
kbilsted / ProgrammerKeyboardRemapping.ahk
Last active March 14, 2019 07:33
A keyboard remapping making it easier to program with nordic (DK, SE, NO) Qwerty keyboard layouts
; To use this script first install http://www.autohotkey.com/
; ------------------------------------------------------------
;
; This script remaps your keyboard so it is more convenient to code
; while under the slavery of the nordic QWERTY mapping
;
; The script will do the following
; * Remap alt-j, alt-k. alt-l. alt-i to become cursor movements
; * Remap å and ¨ to imulate the nice position of []{} on US-QWERTY
; * Remap alt-h to be ";\n" since that is a very frequent sequence for C#. Java, C, ... programmers
@kbilsted
kbilsted / hg2git.md
Last active May 2, 2020 16:22
Git guide for Hg users

A Git guide for Hg/Mercurial users

Delete stuff

  • hg uncommit / hg strip
  • git reset --hard HEAD~1

Combine stuff