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
import datetime | |
import time | |
from pymongo import MongoClient | |
client = MongoClient('connection to mongod') | |
db = client['mongo database'] | |
collection = db.ping | |
while True: | |
try: |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Angular app with reactive js</title> | |
<script src="http://code.jquery.com/jquery-2.0.3.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/rxjs/2.2.3/rx.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/rxjs-jquery/1.1.3/rx.jquery.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/rxjs/2.2.3/rx.time.js"></script> |
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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<WorkingFolder>$(MSBuildProjectDirectory)</WorkingFolder> | |
<Configuration>Release</Configuration> | |
<SolutionFile>WebApplication1.sln</SolutionFile> | |
</PropertyGroup> | |
<Target Name="BuildAll" DependsOnTargets="Compile;Test" /> | |
<Target Name="Compile"> |
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 class EvilTests | |
{ | |
[DllImport("user32.dll", SetLastError = true)] | |
static extern bool LockWorkStation(); | |
[Fact] | |
public void EvilTest() | |
{ | |
var result = LockWorkStation(); | |
} |
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 class var{ } |
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
If: | |
- you add and commit with the wrong email address in git, and | |
- your remote has a hook set up to prevent you from pushing with the bad address | |
Then you need to amend the author of your commit before push can succeed: | |
1. fix your email address in git config: | |
$ git config user.name "Your Name" |
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
// version before refactoring | |
using (var key = Registry.CurrentUser.OpenSubKey(RegistryKey, true)) | |
{ | |
var obfuscator = new ViewNameObfuscator("whatever"); | |
key.SetValue("password", obfuscator.Obfuscate(value)); | |
key.Close(); | |
} | |
// version after refactoring - the functionality remained the same - exacly the same | |
return ReadValueFromRegistry(PasswordKeyName, Deobfuscate); |
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 static class Expressions | |
{ | |
static string code = @" | |
public static class __CompiledExpr__ | |
{{ | |
public static {0} Run({1}) | |
{{ | |
return {2}; | |
}} |
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 class AutoNSubstituteAttribute : AutoDataAttribute | |
{ | |
public AutoNSubstituteAttribute() | |
: base(()=>new Fixture() | |
.Customize(new AutoPopulatedNSubstitutePropertiesCustomization()) | |
) | |
{ | |
} | |
} |
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 static class NSubstituteHelper | |
{ | |
public static void IgnoreAwaitForNSubstituteAssertion(this Task task) | |
{ | |
} | |
} |
OlderNewer