Skip to content

Instantly share code, notes, and snippets.

@rasor
rasor / SomeScript1.bat
Last active December 2, 2015 11:07
PowerShell script startup project with configfile and logfile
rem
rem you must run this script as admin
c:
cd C:\scripts
powershell Set-ExecutionPolicy Unrestricted
powershell Get-ExecutionPolicy
powershell .\'SomeScript1.ps1' .\'SomeScript1.xml'
powershell Set-ExecutionPolicy Restricted
@rasor
rasor / myjob.bat
Last active December 20, 2015 22:49
A sample for scheduling a job (myjob.exe) in task scheduler. http://rasor.wordpress.com/2013/08/12/powershell-scheduling-a-task/
c:
cd C:\PathToExecutableFile
PowerShell.exe -ExecutionPolicy Bypass -NonInteractive -FILE myjob.ps1
pause
@rasor
rasor / objectpropsnippet.cs
Created September 13, 2013 05:35
New up an object in a property
private PersonModel _person;
public PersonModel SomePerson
{
get { return _person ?? (_person = new PersonModel()); }
set { _person = value; }
}
@rasor
rasor / BeeDistance_From_Start.js
Last active July 3, 2016 19:36
Suunto app. Name: BeeDistance From Start, Activity: Running, Category: Competion
/* http://www.movescount.com/apps/app11024800-BeeDistance_From_Start */
/* https://gist.github.com/rasor/0b326fb2ad208029f036544df9e1b21c */
/* Suunto app. Name: BeeDistance From Start, Activity: Running, Category: Competion*/
/* Description: Calculates Beeline distance to your start GPS point.*/
/* Initialize own vars - set in app
prefix = "BDist";
postfix = "m";
timerHasBeenStarted = 0;
startHasBeenSet = 0;
latStart = -90;
@rasor
rasor / GPS_Lapr_400.js
Last active July 5, 2016 18:51
Suunto app. Name: GPS Lapr 400, Activity: Running, Category: Counter
/*
V.B: http://www.movescount.com/apps/app11029302-GPS_Lapr_B
V.A: http://www.movescount.com/apps/app11022053-GPS_Lapr_400
*/
/* https://gist.github.com/rasor/7223f9db3fd8090d64708642425f2af2 */
/* Suunto app. Name: GPS Lapr 400, Activity: Running, Category: Counter*/
/* Description:
Header:
Count laps using your start GPS point.
Version:
using System;
using System.IO;
using System.Dynamic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ImportTests.Interfaces;
namespace ImportTests.Imports
@rasor
rasor / Startup.cs
Created January 7, 2018 14:53 — forked from robzhu/Startup.cs
OWIN Startup configuration for JSON serialization
using System.Collections.Generic;
using System.Web.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using Owin;
using Swashbuckle.Application;
namespace Project
{
@rasor
rasor / Preferences.sublime-settings
Created January 8, 2018 08:53
SublimeText3 user settings - AppData\Roaming\Sublime Text 3\Packages\User
{
"show_encoding": true,
"hot_exit": false,
"ignored_packages":
[
"Vintage"
],
"remember_open_files": false,
"word_wrap": false
}
@rasor
rasor / move.sh
Created April 15, 2018 10:30
Move dirs + subdirs
#!/bin/bash
# move dirs + subdirs
mv -f ./'Ordnede filer'/* /g/Seagate/'Ordnede filer'/
echo "done"
# pause
read -rsp $'Press any key to continue...\n' -n 1 key
@rasor
rasor / PrintSqlDbs.sql
Created April 17, 2018 11:31
Print all MS SQL DB's on a server
-- Print all MS SQL DB's on a server
SELECT name FROM master.dbo.sysdatabases
WHERE name NOT IN ('master', 'tempdb', 'model', 'msdb');