Skip to content

Instantly share code, notes, and snippets.

@axrwkr
axrwkr / planets.fsx
Created February 9, 2013 12:27
Return a list of planets
#r "FSharpx.TypeProviders.Freebase.1.6.137/lib/40/FSharpx.TypeProviders.Freebase.dll"
let ctx = FSharpx.TypeProviders.Freebase.FreebaseData.GetDataContext()
for e in ctx.``Science and Technology``.Astronomy.Planets do
printfn "%s" e.Name
@axrwkr
axrwkr / ModifyExpression.cs
Last active December 15, 2015 04:18
expression visitor example
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace ModifyExpression
{
class Program
@axrwkr
axrwkr / Program.cs
Created April 24, 2013 06:53
Save a value in between exe invocations via a user setting
using SaveCount.Properties;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SaveCount
{
class Program
@axrwkr
axrwkr / sln - black background.xml
Last active December 22, 2015 15:39 — forked from CADbloke/VisualStudioSolutionSLNstyler.xml
notepad++ sln syntax highlighting. black background
<!-- NP++ Language menu ==> Define your Language ==> click Import in the window that just popped up -->
<NotepadPlus>
<UserLang name="SLN" ext="sln" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">03 04 00# 01 02</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
@axrwkr
axrwkr / HelloWorld.html
Created September 9, 2013 10:18
hello world
<html>
<head><title>hello world</title></head>
<body>hello world</body>
</html>
@axrwkr
axrwkr / sln - white background.xml
Created September 16, 2013 22:32
notepad++ sln syntax highlighting. white background
<NotepadPlus>
<UserLang name="SLN" ext="sln" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="no" Keywords3="no" Keywords4="no" Keywords5="no" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">03 04 00# 01 02</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>
@axrwkr
axrwkr / sql_autofix_example.sql
Last active August 29, 2015 13:57
SQL Server Autofix Logins
-- to list orphaned users
EXEC sp_change_users_login 'Report'
-- to fix a specific user (replace <user> with the user name)
EXEC sp_change_users_login 'Auto_Fix', [<user>]
-- to fix a user and create new login and password
EXEC sp_change_users_login 'Auto_Fix', [<user>], NULL, '<password>'
@axrwkr
axrwkr / clear_cache.aspx
Created March 31, 2014 14:55
Clear the asp.net cache
<script language="C#" runat="server">
protected void Page_Load(Object s, EventArgs e)
{
foreach (DictionaryEntry entry in HttpContext.Current.Cache){
HttpContext.Current.Cache.Remove(entry.Key.ToString());
}
}
</script>
@axrwkr
axrwkr / permissions.sql
Created April 2, 2014 09:33
list database object with user and role permissions
select schema_name(o.schema_id) as [Schema_Name]
, o.name as [object_name]
, u.name as [principal_name]
, u.type_desc as [principal_type]
, r.minor_id, r.permission_name, r.state_desc
, o.schema_id, o.principal_id as [alt_owner], o.type_desc
from sys.database_permissions r
Left Join sys.database_Principals u
ON r.grantee_principal_id = u.principal_id
Left Join sys.all_objects o
@axrwkr
axrwkr / xml dml delete examples.sql
Created April 11, 2014 14:46
xml dml delete examples
DECLARE @myDoc xml
SET @myDoc = '<?Processing Instructions for=EXE.exe ?>
<root>
<!-- instructions for the 1st work center -->
<country LocationID="10"
GDP="1.1"
GNI=".2" >Some text 1
<city id="1">London</city>
<city>Manchester</city>
<city id="3">Liverpool</city>