Skip to content

Instantly share code, notes, and snippets.

@DCCoder90
DCCoder90 / decrapify.ps1
Created December 21, 2018 22:12
Windows Decrapifier
#Windows 10 Decrapifier 1803/1809
#By CSAND
#Nov 14 2018
#
#
#PURPOSE: Eliminate much of the bloat that comes with Windows 10. Change many privacy settings to be off by default. Remove built-in advertising, Cortana, OneDrive, Cortana stuff (all optional). Disable some data collection.
# Clean up the start menu for new user accounts. Remove a bunch of pre-installed apps, or all of them (including the store). Create a more professional looking W10 experience. Changes some settings no longer
# available via GPO for Professional edition.
#
#DISCLAIMER: Most of the changes are easily undone, but some like removing the store are difficult to undo. I encourage you to research these changes beforehand, and read through the script.
@DCCoder90
DCCoder90 / EntityBuilder.cs
Created December 6, 2018 21:50
Creates objects at runtime to store information
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
namespace EntityBuilder
{
internal class EntityBuilder
{
private readonly IDictionary<string, Type> _cache;
@DCCoder90
DCCoder90 / DataChecker.cs
Created November 1, 2018 18:03
Dictionary Switch - Proves that you can use a dictionary to work the same as a switch making it easier to maintain and more flexible.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DictionarySwitch
{
public class DataChecker
{
@DCCoder90
DCCoder90 / Program.cs
Created September 19, 2018 21:33
For micro-api tutorial
using System;
using Microsoft.Owin.Hosting;
namespace SelfHosted{
class Program{
static void Main(string[] args){
using (WebApp.Start("http://localhost:8080")){
Console.WriteLine("Web Server is running.");
Console.WriteLine("Press any key to quit.");
Console.ReadLine();
@DCCoder90
DCCoder90 / Controller.cs
Created September 19, 2018 21:32
For micro-api tutorial
using System.Collections.Generic;
using System.Web.Http;
namespace SelfHosted{
public class HelloController : ApiController{
// GET api/hello
public IEnumerable Get(){
return new string[] { "Hello", "World" };
}
@DCCoder90
DCCoder90 / Startup.cs
Created September 19, 2018 21:30
For micro-api tutorial
using System.Web.Http;
using Owin;
namespace SelfHosted{
public class Startup{
public void Configuration(IAppBuilder app){
// Configure Web API for self-host.
var config = new HttpConfiguration();
config.Routes.MapHttpRoute(
name: "DefaultApi",
@DCCoder90
DCCoder90 / truncate.sql
Created August 27, 2018 17:51
Truncate tables with respect to FKs
SET NOCOUNT ON
GO
DECLARE @table TABLE(
RowId INT PRIMARY KEY IDENTITY(1, 1),
ForeignKeyConstraintName NVARCHAR(200),
ForeignKeyConstraintTableSchema NVARCHAR(200),
ForeignKeyConstraintTableName NVARCHAR(200),
ForeignKeyConstraintColumnName NVARCHAR(200),
PrimaryKeyConstraintName NVARCHAR(200),
@DCCoder90
DCCoder90 / columnSearch.sql
Created August 27, 2018 17:49
Query that searches system tables to identify a table that has a specified column name
SELECT c.name AS 'ColumnName'
,t.name AS 'TableName'
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%COLUMN NAME%'
ORDER BY TableName
,ColumnName;
@DCCoder90
DCCoder90 / detectBlocking.sql
Created August 27, 2018 17:48
Query to detect any blocking queries
SELECT blocked_query.session_id AS blocked_session_id,
blocking_query.session_id AS blocking_session_id,
sql_text.text AS blocked_text,
sql_btext.text AS blocking_text,
waits.wait_type AS blocking_resource
@DCCoder90
DCCoder90 / getFullyQualifiedName.sql
Created August 20, 2018 13:56
Get fully qualified object name from object id
create function dbo.getFullyQualifiedName(
@objectid int
) returns sysname
begin
declare @fqn sysname
select
@fqn = CONCAT(
QUOTENAME(@@SERVERNAME), '.',
QUOTENAME(DB_NAME()), '.',