Skip to content

Instantly share code, notes, and snippets.

@jschementi
jschementi / git-tfs.md
Created January 26, 2010 08:35
Using TFS and GIT together

Using TFS and GIT together

What if your team uses TFS, but you want offline support? You can have a Git repo as well, but then getting your changes to TFS is burdensome. Here’s where a GIT to TFS bridge would be handy.

Setting up your repo

Here’s how to keep a TFS repository foo, and a GIT repository bar, in sync. First step is you need to create a new TFS workspace:

cd \

tf workspace /new /noprompt Foo

@joey-qc
joey-qc / TSQL-to-POCO
Created September 26, 2013 06:56
A simple TSQL script to quickly generate c# POCO classes from SQL Server tables and views. You may tweak the output as needed. Not all datatypes are represented but this should save a bunch of boilerplate coding. USAGE: Run this query against the database of your choice. The script will loop through tables, views and their respective columns. Re…
declare @tableName varchar(200)
declare @columnName varchar(200)
declare @nullable varchar(50)
declare @datatype varchar(50)
declare @maxlen int
declare @sType varchar(50)
declare @sProperty varchar(200)
DECLARE table_cursor CURSOR FOR
@vors
vors / xmlToString.ps1
Created March 21, 2015 21:13
PowerShell function to convert any [xml] element to string
function Convert-XmlElementToString
{
[CmdletBinding()]
param(
[Parameter(Mandatory=$true)]
$xml
)
$sw = [System.IO.StringWriter]::new()
$xmlSettings = [System.Xml.XmlWriterSettings]::new()
@yvanin
yvanin / AwsV4SignatureCalculator.cs
Last active March 5, 2024 20:37
This C# code calculates a request signature using Version 4 signing process. It was developed for and tested on Amazon SQS requests, so it does not cover every scenario for the other services, e.g. multipart uploads are not supported. Nevertheless, it's simple and independent single class that can be easily embedded into other projects. .NET Fra…
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Net.Http;
using System.Security.Cryptography;
using System.Text;
namespace AwsV4SignatureCalculator
@AlbertoMonteiro
AlbertoMonteiro / 01.md
Last active January 23, 2024 10:11
Migration from Moq to NSubstitute
@mattiaslundberg
mattiaslundberg / Ansible Let's Encrypt Nginx setup
Last active June 10, 2024 01:44
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@unitycoder
unitycoder / FasterLineSegmentIntersection.cs
Last active February 22, 2024 12:03
Math Algorithms c# Calculate - 2D Line Intersection
// https://forum.unity.com/threads/line-intersection.17384/#post-4442284
bool FasterLineSegmentIntersection (Vector2 line1point1, Vector2 line1point2, Vector2 line2point1, Vector2 line2point2) {
Vector2 a = line1point2 - line1point1;
Vector2 b = line2point1 - line2point2;
Vector2 c = line1point1 - line2point1;
float alphaNumerator = b.y * c.x - b.x * c.y;
float betaNumerator = a.x * c.y - a.y * c.x;
float denominator = a.y * b.x - a.x * b.y;
@maxreb
maxreb / JsonSerializerExtensions.cs
Created November 29, 2022 15:29
Benchmark PopulateObject
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Text.Json;
using System.Text.Json.Serialization.Metadata;
public static class JsonSerializerExt
{
// Dynamically attach a JsonSerializerOptions copy that is configured using PopulateTypeInfoResolver
private readonly static ConditionalWeakTable<JsonSerializerOptions, JsonSerializerOptions> s_populateMap = new();