Skip to content

Instantly share code, notes, and snippets.

View drasive's full-sized avatar

Dimitri Vranken drasive

  • Switzerland
View GitHub Profile
@drasive
drasive / Helpers.cs
Last active August 10, 2023 13:01
.NET Swagger - Members Inherit Documentation From Base Member
public static class Helpers
{
public static XPathNavigator? GetMemberXmlNode(List<XPathDocument> documents, string memberName)
{
var path = $"/doc/members/member[@name='{memberName}']";
foreach (var document in documents)
{
var node = document.CreateNavigator().SelectSingleNode(path);
if (node != null)
@drasive
drasive / assembly_version_checker.ps1
Created February 16, 2017 15:42
Bulk .NET Assembly Version Checker
$directory = "TO_BE_SET"
$fileFilter = "TO_BE_SET"
$tableOrder = `
@{ `
Expression = {[System.Diagnostics.FileVersionInfo]::GetVersionInfo($_.FullName).ProductVersion.ToString()}; `
Descending = $False}, `
@{ `
Expression = {$_.Name}; `
Descending = $False}
#!/bin/sh
# Get parameters
git_repository_path=$1 # Path to the Git repository that is used for the backup (local)
git_remote_path=$2 # Path of the Git remote that is used for the backup (external)
# Add files to Git index and create commit
(cd $git_repository_path &&
git add . &&
git commit -m "Automated commit by git-backup" --quiet 1> /dev/null)
@drasive
drasive / GenerateAuditTableAndTrigger-MSSQL.sql
Last active January 21, 2016 13:14 — forked from edeustace/sp.AutoGenerateAuditTableAndTrigger.sql
Stored procedure for MS SQL Server to generate history tables and triggers.
/************************************************************************************************************
Inspired by: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=84331
Created By: Bryan Massey
Created On: 3/11/2007
Updated By: Dimitri Vranken
Updated On: 21/01/2016
Explanation:
1) Queries system tables to retrieve table schema for @TableName parameter.
$path = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
$maximumDirectoryDepth = 3
$excludedDirectories = @()
$directoryDepth = 0
$repositoriesUpdated = 0
function Get-IsSvnRepository($path) {
svn info $path > $null 2>&1
@drasive
drasive / 00874.0.txt
Last active October 30, 2015 08:04
TIS-100 solutions (http://www.zachtronics.com/tis-100/, assembler video game).
@0
MOV RIGHT, DOWN
@1
MOV UP, LEFT
@2
@3
@drasive
drasive / haX0r.cmd
Created June 4, 2015 15:36
Repeatedly outputs the whole C: drive as a tree to the console (using green font to be L337).
@echo off
:setup
color 0a
C:
cd \
:execute
tree
@drasive
drasive / matrix.cmd
Created June 4, 2015 15:29
Outputs random 1's and 0's to the console, like in the movie Matrix.
@echo off
setlocal ENABLEDELAYEDEXPANSION
:setup
color 02
:execute
set line=
for /L %%i in (1,1,80) do (
set /a "number=!random! &1"
@drasive
drasive / random-drive-ejector.vbs
Created June 4, 2015 15:23
Ejects and inserts a computers optical drives in random intervals.
' Variables
Dim waitTimeForStartMinimum
Dim waitTimeForStartMaximum
Dim waitTimeBetweenEjectAndInsertMinimum
Dim waitTimeBetweenEjectAndInsertMaximum
Dim waitTimeBetweenInsertAndEjectMinimum
Dim waitTimeBetweenInsertAndEjectMaximum
@drasive
drasive / orFilter.js
Last active August 29, 2015 14:21
AngularJS - OR filter for multiple, specific properties filtered by a single search string.
app.filter('orFilter', function () {
return function (objects, properties, comparator) {
if (!objects|| objects.length === 0) {
return [];
}
if (!properties || properties.length === 0) {
return [];
}
if (!comparator || comparator.trim() === '') {
return objects;