Skip to content

Instantly share code, notes, and snippets.

View xanthalas's full-sized avatar

Xanthalas xanthalas

  • Cambridge, England
View GitHub Profile
@xanthalas
xanthalas / Blog-CreatorClasses-1.cs
Created May 30, 2023 20:22
Blog-CreatorClasses-1
public class Person
{
public Person(
string firstName,
string lastName,
int age,
IEnumerable<string> hobbies,
IEnumerable<string> favouriteThings)
{
this.FirstName = firstName;
@xanthalas
xanthalas / .actions-tree.json
Last active January 28, 2022 07:49
Config file for the Rider plugin "Actions Tree"
{
"items": [
{
"keys": ["alt S"],
"items": [
{ "keys": ["S"], "id": "SurroundWith" },
{ "keys": ["F"], "id": "ReformatCode"},
{ "keys": ["R"], "id": "RecentLocations", "separator-above": "" },
{ "keys": ["T"], "id": "CloseContent" },
{ "keys": ["U"], "id": "UnsplitAll" }
@xanthalas
xanthalas / .ideavimrc
Last active July 12, 2022 08:14
IdeaVim settings used in Rider
" Useful shortcuts:
"
" Alt-Left/Right Previous/Next tab
"
"
"
"
set ignorecase "Normal searches are not case sensitive
set smartcase "Over-ride case-insensitivity if the search string contains an upper case char
@xanthalas
xanthalas / get-branch-name.js
Last active May 1, 2020 11:04
NodeJs script to copy matching GIT branch name to the clipboard
var clipboard = require('copy-paste');
var fs = require('fs');
var exec = require('child_process').exec;
var result = '';
var searchTerm = process.argv[2];
if (!searchTerm) {
console.log("No search term specified. Usage: get-branch-name string-to-search-for");
@xanthalas
xanthalas / .vsvimrc
Last active June 17, 2021 09:14
vsvimrc for VS Vim on Visual Studio
set ignorecase "Normal searches are not case sensitive
set smartcase "Over-ride case-insensitivity if the search string contains an upper case char
set hlsearch "switch off with nohlsearch
set nowrapscan "Stop search from wrapping at end of file
set incsearch "Switch on incremental searching
set clipboard=unnamed " VimTip 21: easy pasting to windows apps <http://vim.sf.net/tips/tip.php?tip_id=21> yank always copies to unnamed register, so it is available in windows clipboard for other applications.
let mapleader = "\"
set ignorecase
set smartcase
@xanthalas
xanthalas / locktoggle.cs
Created November 1, 2017 08:41
Small C# program to enable/disable the Windows lock (Windows+L)
using System;
using Microsoft.Win32;
public class LockToggle {
public static void Main(string[] args) {
// The name of the key must include a valid root.
const string userRoot = "HKEY_CURRENT_USER";
const string subkey = @"Software\Microsoft\Windows\CurrentVersion\Policies\System";
const string keyName = userRoot + "\\" + subkey;
@xanthalas
xanthalas / togglelock.ps1
Created July 25, 2017 19:06
Powershell script to enable/disable the Windows lock facility (Win+L)
param([Int32]$value=0)
$registryPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System"
$Name = "DisableLockWorkstation"
IF(!(Test-Path $registryPath))
{
Write-Host "Cannot change the status as the key cannot be found"
}
ELSE
{
@xanthalas
xanthalas / gist:edd22e7e91b346ea8b2d55c90f0a5c0c
Created June 26, 2017 09:43
Fuslogvw.exe Assembly Binding Log viewer
https://docs.microsoft.com/en-us/dotnet/framework/tools/fuslogvw-exe-assembly-binding-log-viewer
This tool comes with Visual Studio and will help with diagnosing issues with assembly binds
where .Net cannot locate an assembly at runtime.
/* Used this after McAfee decided my hard drive was "removable" and set it to read-only as per the company group policy */
/* Making it read-only made all the databases unavailable but once it was writeable again the code below fixed them */
ALTER DATABASE [my_database_name] SET SINGLE_USER WITH NO_WAIT
ALTER DATABASE [my_database_name] SET EMERGENCY
DBCC checkdb ([my_database_name], REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE [my_database_name] SET ONLINE
ALTER DATABASE [my_database_name] SET MULTI_USER WITH NO_WAIT
@xanthalas
xanthalas / gist:d0003c8cff0ea30f1efaee16713050e5
Created March 23, 2017 11:43
Tell svn to use an external diff program
svn diff --diff-cmd=C:\vim\vim80\diff.exe
For example. To use the one in Vim and tell it to not display any context lines use:
svn diff --diff-cmd=C:\vim\vim80\diff.exe -x --context=0