Skip to content

Instantly share code, notes, and snippets.

@kiquenet
kiquenet / gist:4964f650fe70c3180ea6
Created November 19, 2015 08:39
SSRS analytics Queries
Use ReportServer
go
/* Performance Tips
1. High TimeDataRetriveal
* Removed unused datasets
* Analyze the dataset query in SQL Profiler
* Combine Datasets where possible
2. High TimeProcessing
* Use less report parts (tables, charts...)
* Do Grouping and Sorting on the SQL Side
@haacked
haacked / FormatAllFiles.ps1
Created May 21, 2011 08:06
Format all CS files in a Visual Studio solution (UGLY VERSION)
// Open up the NuGet Package Manager in Visual Studio and paste the following line to format every file in the solution.
// I'll write a not-so-ugly version later. ;)
// BUG! This doesn't recursively grab all files from the project. :(
$dte.Solution.Projects | ForEach-Object {$_.ProjectItems | ForEach-Object { if ($_.Name.EndsWith('.cs')) {$window = $_.Open('{7651A701-06E5-11D1-8EBD-00A0C90F26EA}'); if ($window){Write-Host $_.Name;[System.Threading.Thread]::Sleep(100);$window.Activate();$_.Document.DTE.ExecuteCommand('Edit.FormatDocument');$_.Document.DTE.ExecuteCommand('Edit.RemoveAndSort');$window.Close(1);}} }}
@andrerocker
andrerocker / sqlserver-dump.ps1
Created October 30, 2010 22:12
Powershell Script to: Export all data from yours SQLServer like mysqldump
$database_host = "<host>"
$database_name = "<database>"
$output_file = "<output_file>"
$user = "<username>"
$password = "<password>"
[system.reflection.assembly]::loadWithPartialName('Microsoft.SqlServer.SMO')
$server = new-object "Microsoft.SqlServer.Management.Smo.Server" $database_host
$server.connectionContext.loginSecure = $false
@tcaddy
tcaddy / check_student_planning.js
Last active March 16, 2018 08:14
A PhantomJS script to monitor Ellucian Student Planning / Self-Service for unresponsiveness. A PowerShell script to run the PhantomJS script and recycle the app pool, send an email.
/*
Student Planning goes down randomly and we have to recycle the app pool to fix it.
This script will try to login to Student Planning and make an AJAX request. It will
return text output (console.log() output) about whether it is working or not.
NOTE: this script relies on PhatomJS, which you can download here:
http://phantomjs.org/download.html
NOTE: change the values of the host, user, and pass variables. Optionally change the timeout variable.
*/
@haf
haf / gist:5629584
Last active January 23, 2019 20:59
Finding the private key of a Windows certificate from PowerShell/C#.
namespace PKI
{
class Results : IEquatable<Results>
{
internal static readonly Results NotFound = new Results
{
Directory = "",
KeyName = ""
};
@mhenrixon
mhenrixon / JobRegistry.cs
Created January 10, 2011 11:03
A quick way to setup quartz with structuremap
internal class JobRegistry :Registry
{
public JobRegistry()
{
ForSingletonOf<PlaynGO.Common.InversionOfControl.IContainer>().Use<PlaynGO.StructureMap.Container>();
ForSingletonOf<IJobFactory>().Use<WpsJobFactory>();
var col = new NameValueCollection();
ForSingletonOf<ISchedulerFactory>().Use<StdSchedulerFactory>().Ctor<NameValueCollection>("props").Is(ctx =>
{
#Requires -RunAsAdministrator
#Requires -Version 3.0
#References:
#Getting Started with Nano Server <https://technet.microsoft.com/en-us/library/mt126167.aspx>
#Quick Guide - Deploying Nano Server using PowerShell <http://deploymentresearch.com/Research/Post/479/Quick-Guide-Deploying-Nano-Server-using-PowerShell>
param (
#[ValidateScript({ Test-Path $_ })]
$ConvertWindowsImageScriptPath = 'D:\work\NanoServerSetup\Convert-WindowsImage.ps1'
@drasticactions
drasticactions / jsonnet.workbook
Created March 16, 2017 17:13
JSON.NET Deserialize Example
uti platforms packages
com.xamarin.workbook
Console
id version
Newtonsoft.Json
9.0.1

JSON.NET Deserialize Example

@craigrbruce
craigrbruce / ApiClient.cs
Last active April 26, 2022 23:06
An example REST API client for C#
/*
Call the api client like this:
var client = new ApiClient<SEnvelope>("https://baseurl.com/api/v1");
//you would overload and add an auth_token param here
client.GetDtoAsync("envelopes", "object_id", (response) => //callback
{
this.SEnvelope = response.Data;//should be an envelope from the server
});
@haeky
haeky / encryption.cs
Created June 17, 2013 14:34
Encrypt, decrypt and generate a key in C# using AES256.
#region Encryption
/// <summary>
/// Generate a private key
/// From : www.chapleau.info/blog/2011/01/06/usingsimplestringkeywithaes256encryptioninc.html
/// </summary>
private static string GenerateKey(int iKeySize)
{
RijndaelManaged aesEncryption = new RijndaelManaged();
aesEncryption.KeySize = iKeySize;
aesEncryption.BlockSize = 128;