Skip to content

Instantly share code, notes, and snippets.

View RaccoonDev's full-sized avatar
🏠
Working from home

Dmytro Mykhailov RaccoonDev

🏠
Working from home
View GitHub Profile
@RaccoonDev
RaccoonDev / proxy.js
Last active August 29, 2015 14:15
Simple NodeJS Proxy
//Use this script as proxy where you can specify custom headers
//that will be sent to destination server
//TODO
//[X] Measure request time and write it to console
//[ ] Write measured request time to log file instead of console
//[ ] Make lookup list of possible custom headers to simulate different logins
var http = require('http');
@RaccoonDev
RaccoonDev / deploy.sh
Created February 20, 2015 20:40
Azure deployment with grunt build before publishing
#!/bin/bash
# ----------------------
# KUDU Deployment Script
# Version: 0.1.11
# ----------------------
# Helpers
# -------
@RaccoonDev
RaccoonDev / gist:8dbe1e0a28535b7ed599
Created March 24, 2015 15:01 — forked from jaredhanson/gist:2559730
Sample of Restify app with facebook authentication
// Based off example code from Hal Robertson
// https://github.com/halrobertson/test-restify-passport-facebook
// See discussion: https://groups.google.com/forum/?fromgroups#!topic/passportjs/zCz0nXB_gao
var restify = require('restify')
// config vars
var FB_LOGIN_PATH = '/api/facebook_login'
var FB_CALLBACK_PATH = '/api/facebook_callback'
var FB_APPID = '<<YOUR APPID HERE>>'
@RaccoonDev
RaccoonDev / gist:11ceb952254c50d00721
Created March 30, 2015 14:19
Object and Stream Extensions to work with stream and json
public static class ObjectExtensions
{
public static string GetMessageType(this object obj)
{
return obj.GetType().AssemblyQualifiedName;
}
public static string ToJsonString(this object obj)
{
@RaccoonDev
RaccoonDev / SavePassword.ps1
Created April 21, 2015 20:09
Save Password in Encrypted File
function Save-Password
{
Param
(
[parameter(Mandatory = $true)]
[String]
$FilePath,
[parameter(Mandatory = $true)]
[Switch]
@RaccoonDev
RaccoonDev / New-Environment.ps1
Created April 21, 2015 20:14
Publish ASP.Net MVC Application to Azure WebAps. CI ready PowerShell scripts.
Param(
[string][Parameter(Mandatory=$true)] $WebSiteName,
[string] $ResourceGroupName = $WebSiteName,
[string] $StorageAccountName = $ResourceGroupName.ToLowerInvariant() + "storage",
[string] $ResourceGroupLocation = "West Europe",
[string] $StorageContainerName = $WebSiteName.ToLowerInvariant(),
[string] $TemplateFile = '.\Templates\WebSiteDeploySQL.json'
)
$ErrorActionPreference = "Stop";
@RaccoonDev
RaccoonDev / Account.ps1
Created April 21, 2015 20:16
Add-AzureAccount with stored credentials
<#
# Create PWD File with this command:
# Read-Host -AsSecureString | ConvertFrom-SecureString | out-file <<<PATH_TO_FILE>>>
You can find instructions how to add deployment user to your subscription here:
http://azure.microsoft.com/en-us/documentation/articles/powershell-install-configure/
#>
$pwdFilePath = "<<<PATH_TO_FILE>>>"
@RaccoonDev
RaccoonDev / ReaddSqlUsers.ps1
Created April 28, 2015 13:53
Readd SQL Server Users
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo") | Out-Null;
$serverName = 'localhost';
$vbbUserName = '<<<Add username here>>>';
$databasesToWorkWith = @(<<<Added Databases Here>>>)
########################################
$server = New-Object "Microsoft.SqlServer.Management.Smo.Server" $serverName;
$login = $server.Logins[$vbbUserName];
@RaccoonDev
RaccoonDev / gist:c196ec17c23a9998793d
Created May 26, 2015 09:01
Check is DNS points to local IP address
public static bool IsLocalhost(string hostNameOrAddress)
{
if (string.IsNullOrEmpty(hostNameOrAddress))
return false;
try
{
// get host IP addresses
IPAddress[] hostIPs = Dns.GetHostAddresses(hostNameOrAddress);
// get local IP addresses
@RaccoonDev
RaccoonDev / Get User Thumbnail and store in file
Created June 12, 2015 14:12
Ask Active Directory For User Data
#get thumbnail bytes array
$userThumbnail = (Get-ADUser dmytro_mykhailov -Properties thumbnailPhoto).thumbnailPhoto;
#store bytes array into file
Set-Content -Value $userThumbnail -Encoding byte -Path thumbnail.png