Skip to content

Instantly share code, notes, and snippets.

View vardars's full-sized avatar

vardars vardars

View GitHub Profile
@vardars
vardars / gist:a5681d2feb63fa29a39c
Created October 24, 2014 16:29
onename verification
Verifying that +vardars is my Bitcoin username. You can send me #bitcoin here: https://onename.io/vardars
@vardars
vardars / MSSQL Create Index.sql
Last active September 15, 2015 16:58
MSSQL Create Index Script Generator
SELECT CONVERT (varchar, getdate(), 126) AS runtime,
mig.index_group_handle, mid.index_handle,
CONVERT (decimal (28,1), migs.avg_total_user_cost * migs.avg_user_impact *
(migs.user_seeks + migs.user_scans)) AS improvement_measure,
'CREATE INDEX missing_index_' + CONVERT (varchar, mig.index_group_handle) + '_' +
CONVERT (varchar, mid.index_handle) + ' ON ' + mid.statement + '
(' + ISNULL (mid.equality_columns,'')
+ CASE WHEN mid.equality_columns IS NOT NULL
AND mid.inequality_columns IS NOT NULL
THEN ',' ELSE '' END + ISNULL (mid.inequality_columns, '')
@vardars
vardars / create-dependency-file.ps1
Last active October 9, 2015 13:32
Create project dependencies from solution
# http://blog.dantup.com/2012/05/free-dependency-graph-generation-using-powershell-and-yuml/
function Get-ProjectReferences
{
param(
[Parameter(Mandatory)]
[string]$rootFolder,
[string[]]$excludeProjectsContaining
)
dir $rootFolder -Filter *.csproj -Recurse |
# Exclude any files matching our rules
@vardars
vardars / various-commands.bat
Last active February 23, 2016 07:33
Various Commands in Command Prompt
# merge text files into one
# for %f in (*.txt) do type "%f" >> output.txt # v1
forfiles /p C:\input\ /s /m *.txt /c "cmd /c type @file >> C:\output\output.txt" #v2
@vardars
vardars / convert-text-to-ascii.cs
Last active October 14, 2015 20:23
Text to Ascii
using System;
using System.Drawing;
using System.Text;
namespace AsciiPainter
{
class Program
{
static void Main()
{
@vardars
vardars / git-branch-status.sh
Created November 19, 2015 10:12
Git Custom Commands
#!/bin/bash
# by http://github.com/jehiah
# this prints out some branch status (similar to the '... ahead' info you get from git status)
# example:
# $ git branch-status
# dns_check (ahead 1) | (behind 112) origin/master
# master (ahead 2) | (behind 0) origin/master
git for-each-ref --format="%(refname:short) %(upstream:short)" refs/heads | \
@vardars
vardars / git.bat
Created September 3, 2016 10:27
Git auto comment
npm install html-to-text -g
curl -s http://whatthecommit.com | html-to-text --ignoreHref=true
@vardars
vardars / commit-message.py
Created May 28, 2017 07:43
Windows git hook commit message
#!/usr/bin/env python
import sys, re
from subprocess import check_output
branch = check_output(['git', 'symbolic-ref', '--short', 'HEAD']).strip()
commit_msg_filepath = sys.argv[1]
with open(commit_msg_filepath, 'r') as f:
content = f.read()
@vardars
vardars / publish.ps1
Created October 27, 2017 19:47
msbuild publish powershell script
$solutionName = "$$$SOLUTION_NAME$$$"
$systemRoot = $env:systemroot
$msbuildExe = "$systemRoot\Microsoft.NET\Framework\v4.0.30319\msbuild.exe"
$currentPath = Convert-Path(".")
$currentDate = Get-Date -format yyyyMMdd-HHmm
function ZipFiles( $zipfilename, $sourcedir )
{
Add-Type -Assembly System.IO.Compression.FileSystem