Skip to content

Instantly share code, notes, and snippets.

View georgebearden's full-sized avatar

George Bearden georgebearden

View GitHub Profile
function sleep(millis) {
var start = new Date().getTime();
while ((new Date().getTime() - start) <= millis) {}
}

Different ways to get AWS credentials into the Cognito client

public AmazonCognitoIdentityProviderClient CreateFromKeys()
{
  var creds = new BasicAWSCredentials("ACCESS_KEY", "SECRET_KEY");
  return new AmazonCognitoIdentityProviderClient(creds, RegionEndpoint.USEast1);
}

 public AmazonCognitoIdentityProviderClient CreateFromProfile()
import { createLogger, format, transports } from 'winston'
const { combine, timestamp, label, printf } = format;
const myFormat = printf(info => {
return `${info.timestamp} [${info.label}] ${info.level} - ${info.message}`;
});
module.exports = function(fileName) {
return createLogger({
format: combine(
this.dataProvider.get().subscribe(
async next => {
let document = {...}
const response = await this.es.index(document)
},
error => { reject(error) },
() => { resolve(this.stats.indexCount) })
```
return AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(s => s.GetTypes())
.Where(type => typeof(<the_interface>).IsAssignableFrom(type))
```
using System;
using Newtonsoft.Json;
using System.Reactive.Linq;
using Nito.AsyncEx;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Threading;
using System.Reactive.Threading.Tasks;
namespace Playground
  • \dt - Shows the tables in the database
  • \d+ table_name - Shows the tables schema
  • drop table table_name; - Drops the table named table_name from the database
public static class MethodTimeLogger
{
public static void Log(MethodBase methodBase, long milliseconds)
{
}
}
class Program
{
[Time]
  1. Request a github oauth token
curl -v -X POST \
-H "Authorization: token YOUR_OAUTH_TOKEN_REQUESTED_IN_STEP_1" \
-H "Content-Type: application/json" \
-d '{"description": "testcreategist", "public":false, "files":{"file1.txt":{"content":"some content..."}}}' \
 https://api.github.com/gists 

For Visual Studio 2015, Open a command line window here

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VSSDK\VisualStudioIntegration\Tools\Bin

and execute the following

CreateExpInstance.exe /Reset /VSInstance=14.0 /RootSuffix=Exp &amp;&amp; PAUSE