Skip to content

Instantly share code, notes, and snippets.

View HeLiBloks's full-sized avatar

Henrik Lindgren HeLiBloks

  • Stockholm
View GitHub Profile
## sed ish
$a -replace "([A-z])(23)","$1,$2"
##seq 1 10
1..10
##loop
for ($i=0;$i -lt 10; $i++) { echo $i }
##copy files recursive
@HeLiBloks
HeLiBloks / cSHARPsnippets.cs
Last active August 29, 2015 14:16
C# snippets
//##show message box
MessageBox.Show(Dts.Variables["YourVariableNameHere"].Value.ToString());
//regexMatch [[:number:]]
Regex.Match(Row.var, @"\d+").Value
//
Regex.Match(Row.var, @"[A-Za-z]+").Value
//date 09/12/1980
@HeLiBloks
HeLiBloks / ssisssasssrs
Created March 5, 2015 19:33
SSIS SSRS SSAS snippets
//## timeStamp
(DT_STR,4,1252) DatePart("yyyy",getdate()) +
Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("hour",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("minute",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("second",getdate()),2)
@HeLiBloks
HeLiBloks / .vimrc
Last active August 29, 2015 14:16
.vimrc file for nix
set nocompatible " be iMproved, required
filetype off " required
" " set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" " alternatively, pass a path where Vundle should install plugins
" "call vundle#begin('~/some/path/here')
" " let Vundle manage Vundle, required
@HeLiBloks
HeLiBloks / alias.ps1
Created March 9, 2015 10:34
Aliases for PS
New-Alias -Name grep -Description grep Select-String
@HeLiBloks
HeLiBloks / snippet TSQL CREATE USER
Last active January 20, 2016 18:17
SQL_SERVER snipSnap
--GRANT ALL SQL SERVER
USE master;
go
use [the db];
CREATE LOGIN theUser WITH PASSWORD = 'ComplexPassword01';
CREATE USER theUser FOR LOGIN theUser;
GRANT BACKUP DATABASE, BACKUP LOG, CREATE DEFAULT, CREATE FUNCTION, CREATE PROCEDURE, CREATE RULE, CREATE TABLE, CREATE VIEW,CREATE DATABASE,CONTROL,ALTER
@HeLiBloks
HeLiBloks / .vimperatorrc
Last active August 29, 2015 14:20
.vimperatorrc
source! ~/.vimperatorrc.local
set editor=gvim -f
" vim: set ft=vimperator:
set hintmatching
set hlsearch
set ignorecase
"#set wildmode=auto
" cpt=1
@HeLiBloks
HeLiBloks / .vimrc.smal
Last active April 2, 2016 09:38
.vimrc
" Modeline and Notes"{
" vim: set sw=4 ts=4 sts=4 et tw=78 foldmarker="{,"} foldlevel=0 foldmethod=marker filetype=vim noswapfile spell:
"}
let g:python_host_prog='/usr/bin/python2.7'
let g:python3_host_prog = '/usr/bin/python3'
set nocompatible " be iMproved, required
filetype off " required
@HeLiBloks
HeLiBloks / WindowsServer12R2Labb
Last active October 7, 2016 18:07
BoxStarter
###
# wget https://gist.githubusercontent.com/HeLiBloks/db58ff3978ed6ad8b171/raw/5d34ed59c4e760d22b309de4285bca391f55e1bd/WindowsServer12R2Labb
##
Set-ExplorerOptions -showHidenFilesFoldersDrives -showProtectedOSFiles
Enable-RemoteDesktop
Install-WindowsUpdate -AcceptEula
Update-ExecutionPolicy Unrestricted
### See for details
@HeLiBloks
HeLiBloks / generate_date.sql
Created January 11, 2016 10:02 — forked from rudiv/generate_date.sql
Generate Date Table SQL Server
-- This will insert X years worth of data into a Date table. All fields are INT apart from DayName and DateTime (NVARCHAR(10) and DATE respectively)
-- Update 19/12 now uses ISO Week Number
-- Define start (base) and end dates
DECLARE @basedate DATETIME = '20111101', @enddate DATETIME = '20150101';
DECLARE @days INT = 0, @date DATETIME = '20110101', @maxdays INT = DATEDIFF(dd, @basedate, @enddate);
WHILE @days <= @maxdays
BEGIN
SET @date = DATEADD(dd, @days, @basedate);