Skip to content

Instantly share code, notes, and snippets.

View g-un--'s full-sized avatar

Gino Ungureanu g-un--

View GitHub Profile
@g-un--
g-un-- / Splatting.ps1
Created November 4, 2012 15:47
Sending hash argument as function parameters
# Demo - Sending hash argument as function parameters
$hash = @{ "param1"=1; "param2"=2 };
$hash;
function testHash($param1=$null, $param2=$null)
{
return $($param1 + $param2);
}
@g-un--
g-un-- / QueryWithoutLinkedServer.sql
Created November 5, 2012 12:47
Query without linked server
select columns from openrowset ('sqloledb', 'machineIP';'userName';'password',
'SELECT columns from table')
@g-un--
g-un-- / InsertGeometryGeographyFromLinkedServer.sql
Created November 5, 2012 12:57
Insert geometry, geography from linked server
SELECT * INTO newschema.MyNewTableName
FROM OPENQUERY([MY_SOURCE_SERVER_NAME],
'SELECT * from [source_database_name].[schema_name].[TableName]');
@g-un--
g-un-- / GitBook.txt
Created November 6, 2012 19:21
Great git book!
http://git-scm.com
@g-un--
g-un-- / GroupRegexReplace.ps1
Created November 19, 2012 15:36
Group regex replace powershell
"Test 1.1.1.1" -replace "(?<first>\d+\.\d+\.\d+\.)\d+", '${1}2'
netsh interface portproxy add v4tov4 listenport=port1 listenaddress=* connectport=port2 connectaddress=address
SELECT orderid, orderdate, custid, empid
FROM Sales.Orders
ORDER BY orderdate DESC, orderid DESC
OFFSET 50 ROWS FETCH NEXT 25 ROWS ONLY;
WITH RunningTotals AS
(
SELECT custid, orderid, orderdate, val,
SUM(val) OVER(PARTITION BY custid
ORDER BY orderdate, orderid
ROWS BETWEEN UNBOUNDED PRECEDING
AND CURRENT ROW) AS runningtotal
FROM Sales.OrderValues
)
SELECT *
1. FOR XML RAW('Customer'), ROOT('Customers')
-> rows are node xml elements with <Customer ColumnName="ColumnValue" />
-> columns are attributes
-> root is customers
2. FOR XML ROW('Customer'), ROOT('Customers'), ELEMENTS
-> columns are xml elements
3. FOR XML ROW('Customer'), ROOT('Customers'), ELEMENTS XSINIL
@g-un--
g-un-- / repo.fs
Created May 15, 2014 16:15 — forked from HarryR/repo.fs
(* Copyright © 2014 G Roberts. All Rights Reserved *)
namespace MiniForum.Model
open System
open System.Threading.Tasks
open MiniForum
open MiniForum.Model
open Fredis