Skip to content

Instantly share code, notes, and snippets.

View ajai8085's full-sized avatar
🎯
Focusing

Ajai ajai8085

🎯
Focusing
View GitHub Profile
@ajai8085
ajai8085 / XUbuntu.dev.16.10.md
Created October 22, 2017 01:57
Settingup Ubuntu(XUbuntu 16.10) Development environment

Soon after the installation XUBUNTU 17.10 issue the command Sudo apt-get update sudo apt-get install htop sudo apt-get install build-essential sudo apt-get install apt-transport-https ca-certificates curl software-properties-common

#Install JDK on Ubuntu

--uninstall all versions of java

@ajai8085
ajai8085 / TSQL-to-POCO
Created August 21, 2017 01:16 — forked from joey-qc/TSQL-to-POCO
A simple TSQL script to quickly generate c# POCO classes from SQL Server tables and views. You may tweak the output as needed. Not all datatypes are represented but this should save a bunch of boilerplate coding. USAGE: Run this query against the database of your choice. The script will loop through tables, views and their respective columns. Re…
declare @tableName varchar(200)
declare @columnName varchar(200)
declare @nullable varchar(50)
declare @datatype varchar(50)
declare @maxlen int
declare @sType varchar(50)
declare @sProperty varchar(200)
DECLARE table_cursor CURSOR FOR
@ajai8085
ajai8085 / gist:18617a2eed10305097fb08e5dda6e63c
Created August 17, 2017 05:24 — forked from learncodeacademy/gist:5f84705f2229f14d758d
Getting Started with Vagrant, SSH & Linux Server Administration
# SSH Agent Functions
# Mark Embling (http://www.markembling.info/)
#
# How to use:
# - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice)
# - Import into your profile.ps1:
# e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes]
# - Enjoy
#
# Note: ensure you have ssh and ssh-agent available on your path, from Git's Unix tools or Cygwin.
@ajai8085
ajai8085 / Powershell
Created August 14, 2017 03:38
usefull commands for ssh-agent in powershell
Get-SshAgent - Returns the process ID of the running agent, or zero if there is not one currently running.
Start-SshAgent - Starts the agent process and sets the appropriate environment variables for SSH.
Stop-SshAgent - Stops the process if there is one and unsets the variables.
Add-SshKey - Instructs the agent to add the given key to itself. This will cause you to be prompted for the passphrase.
@ajai8085
ajai8085 / SinglePage.Mvvm.WithEventAggregator.cs
Last active May 8, 2017 23:52
Poor Man's Single Page MVVM with Event Aggregator (Missing validation)
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Windows;
@ajai8085
ajai8085 / ArrowWithPath.xaml
Created May 5, 2017 03:30
WPF Path to draw Arrow left right top bottom
<Window x:Class="WpfApplication6.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<StackPanel>
<Path Fill="Black" Data="M 0 10 L 20 10 L 10 0 Z"/>
<Path Fill="Black" Data="M 0 0 L 10 10 L 20 0 Z"/>
@ajai8085
ajai8085 / AssemblyExtensions.cs
Created February 16, 2017 23:32
Get all instances of custom attribute defined only for classes with allowmultiple=false , useful when using FluentMigrator
public static class AssemblyExtensions{
public static List<TCustomAttribute> GetAllCustomAttributeInstances<TCustomAttribute>(this Assembly assembly)
where TCustomAttribute : Attribute
{
var supportedMigrationVersions = assembly
.GetTypes()
.Where(t => Attribute.IsDefined(t, typeof(TCustomAttribute)))
.Select(t => (t.GetCustomAttribute(typeof(TCustomAttribute)) as TCustomAttribute))
.ToList();
declare @dbName varchar(100)
set @dbName ='MyDatabase'
IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = @dbName)
BEGIN
declare @liveConnections as Table(Id int identity(1,1), name varchar(max), spid int )