This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sequence = Enumerable.Range(0, 3).ToList(); | |
while(true) { | |
sequence.ForEach(e => Console.Beep(650, 100)); | |
Thread.Sleep(200); | |
sequence.ForEach(e => Console.Beep(650, 400)); | |
Thread.Sleep(200); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This cronjob runs at least once a minute and will check if the usage of RAM is more than 75% | |
# if it is more than 75% it sends me an e-mail and invokes the API. API call removed from the example. | |
# When the percentage left after a possible decrease is 70& then it decreases the RAM to that level | |
TOTAL=`free | grep Mem: | awk '{print $2}'` | |
USED=`free | grep Mem: | awk '{print $3}'` | |
INCREASE=$(((TOTAL/1024)+512)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://channel9.msdn.com/Events/Build/2013/4-329 | |
int N = 1000; | |
var A = new int[N,N]; | |
var B = new int[N, N]; | |
var C = new int[N, N]; | |
var random = new Random(); | |
for(int x = 0; x < N; x++) | |
{ | |
for(int y = 0; y < N; y++) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using System.Windows; | |
using System.Windows.Controls; | |
namespace DeadlockExample | |
{ | |
/// <summary> | |
/// Interaction logic for MainWindow.xaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="http://feeds.feedburner.com/fekberg?format=sigpro" type="text/javascript" ></script> | |
<noscript> | |
<p>Subscribe to RSS headline updates from: <a href="http://feeds.feedburner.com/fekberg"></a><br/> | |
Powered by FeedBurner</p> | |
</noscript> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- Using temporary list -- | |
GetList: | |
IL_0000: nop | |
IL_0001: newobj System.Collections.Generic.List<System.String>..ctor | |
IL_0006: stloc.0 | |
IL_0007: nop | |
IL_0008: ldarg.0 | |
IL_0009: ldfld UserQuery._names | |
IL_000E: callvirt System.Collections.Generic.IEnumerable<System.String>.GetEnumerator | |
IL_0013: stloc.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<CodeIssue> GetIssues(IDocument document, CommonSyntaxNode node, CancellationToken cancellationToken) | |
{ | |
if (node.GetType() != typeof(LocalDeclarationStatementSyntax)) return null; | |
var localDeclaration = (LocalDeclarationStatementSyntax)node; | |
var semanticModel = document.GetSemanticModel(cancellationToken); | |
var containingBlock = localDeclaration.FirstAncestorOrSelf<BlockSyntax>(); | |
if (containingBlock == null) return null; | |
var dataFlowAnalysis = semanticModel.AnalyzeDataFlow(containingBlock); | |
var variable = localDeclaration.Declaration.Variables.First(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return new[] { new CodeIssue(CodeIssueKind.Warning, localDeclaration.Span, string.Format("Variable {0} is declared but never used", variable.Identifier)) }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dataFlowAnalysis = semanticModel.AnalyzeDataFlow(containingBlock); | |
var variable = localDeclaration.Declaration.Variables.First(); | |
var symbol = semanticModel.GetDeclaredSymbol(variable); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public IEnumerable<CodeIssue> GetIssues(IDocument document, CommonSyntaxNode node, CancellationToken cancellationToken) | |
{ | |
var tokens = from nodeOrToken in node.ChildNodesAndTokens() | |
where nodeOrToken.IsToken | |
select nodeOrToken.AsToken(); | |
foreach (var token in tokens) | |
{ | |
var tokenText = token.ToString(); |