This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
package_upgrade: true | |
packages: | |
- nginx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select | |
'exec sp_rename @objtype = ''INDEX'', @objname = ''' + quotename(s.name) + '.' + quotename(t.name) + '.' + quotename(pk.name) + ''', @newname = ''' + 'PK_' + t.name + '''' as RenameScript | |
from | |
sys.schemas s | |
inner join | |
sys.tables t | |
on s.schema_id = t.schema_id | |
inner join sys.key_constraints pk | |
on t.object_id = pk.parent_object_id | |
where |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Default Constraint name should match table and column name | |
-- | |
select | |
'ALTER TABLE ' + quotename(s.name) + '.' + quotename(t.name) + ' DROP CONSTRAINT ' + quotename(dc.name) as DropStatement, | |
'ALTER TABLE ' + quotename(s.name) + '.' + quotename(t.name) + ' ADD CONSTRAINT ' + quotename('DF_' + t.name + '_' + c.name) + ' DEFAULT ' + dc.definition + ' FOR ' + quotename(c.name) as CreateStatement | |
from | |
sys.default_constraints dc | |
inner join sys.schemas s | |
on dc.schema_id = s.schema_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Is it possible to cherry-pick a commit from another git repository? | |
# https://stackoverflow.com/questions/5120038/is-it-possible-to-cherry-pick-a-commit-from-another-git-repository | |
git --git-dir=../<some_other_repo>/.git \ | |
format-patch -k -1 --stdout <commit SHA> | \ | |
git am --no-3way -k |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RegexOptions options = RegexOptions.None; | |
Regex regex = new Regex(@"[ ]{ 2,}", options); | |
string input = " 1 2 3 4 5 "; | |
string result = regex.Replace(input, " "); | |
Console.WriteLine("<begin>" + result + "<end>"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const glob = require("glob"); | |
const { exec } = require('child_process'); | |
glob("Pages//**//*.js", function (er, files) { | |
files.forEach(function (cmd) { | |
const jsBeautifyCmd = 'js-beautify ' + cmd + ' -r'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Globalization; | |
using System.Threading; | |
namespace System | |
{ | |
public static class StringExtensions | |
{ | |
public static string ToTitleCase(this string value) | |
{ | |
if (value == null) return null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace System.Collections.Generic | |
{ | |
public static class IEnumerableExtensions | |
{ | |
public static IEnumerable<(T1 Left, T2 Right)> FullOuterJoin<T1, T2>(this IEnumerable<T1> left, IEnumerable<T2> right, Func<T1, T2, bool> match) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Pull all images | |
docker images --format "{{.Repository}}" | %{docker pull $_} |