Skip to content

Instantly share code, notes, and snippets.

View ChrisRisner's full-sized avatar

Chris Risner ChrisRisner

View GitHub Profile
@ChrisRisner
ChrisRisner / EchoBotProjectRename.sh
Created February 5, 2019 22:08
This set of bash commands will rename the EchoBot to MyBot for starter projects.
find . -type f -name '*.*' -exec sed -i '' s/echobot/mybot/ {} +
find . -type f -name '*.*' -exec sed -i '' s/EchoBot/MyBot/ {} +
find . -type f -name '*.*' -exec sed -i '' s/Echo-Bot/My-Bot/ {} +
find . -type f -name '*.*' -exec sed -i '' s/echo-bot/my-bot/ {} +
mv echobot.bot MyBot.bot
mv EchoBot.csproj MyBot.csproj
@ChrisRisner
ChrisRisner / NotificationHubsHelper.java
Created February 4, 2015 19:38
NotificationHubsHelper.java
public static NotificationHub instance;
public static NotificationHub getNotificationHub (Activity activity) {
NotificationsManager.handleNotifications(activity, SENDER_ID, NotificationHubsHelper.class);
String hubName = "myhubname";
String connectionString = "myListenSharedAccessSignature";
instance = new NotificationHub(hubName, connectionString, activity);
return instance;
}
@ChrisRisner
ChrisRisner / IPushNotifierGrain.cs
Last active August 29, 2015 14:07
OrleansSignalRAdventure
[StatelessWorker]
public interface IPushNotifierGrain : Orleans.IGrain
{
Task SendMessage(string message, string recipient);
}
@ChrisRisner
ChrisRisner / keybase.md
Created October 9, 2014 15:13
keybase.md

Keybase proof

I hereby claim:

  • I am chrisrisner on github.
  • I am risner (https://keybase.io/risner) on keybase.
  • I have a public key whose fingerprint is 48D1 BF2E 0905 4113 7C37 90CA 41D2 6986 63AF B5C3

To claim this, I am signing this object:

@ChrisRisner
ChrisRisner / UserfulAzureSnippets
Created September 9, 2014 20:49
UsefulAzure Snippets
foreach (var instance in RoleEnvironment.Roles["RoleName"].Instances)
{
foreach (var endpoint in instance.InstanceEndpoints)
{
endpoints += "instancename: " + endpoint.Key + "\n";
endpoints += "IPEndPoint: " + endpoint.Value.IPEndpoint + "\n";
endpoints += "Protocol: " + endpoint.Value.Protocol + "\n";
endpoints += "PublicIpEnd: " + endpoint.Value.PublicIPEndpoint + "\n";
endpoints += "RoleInstance: " + endpoint.Value.RoleInstance.ToString() + "\n";
}
private async Task AddHub(string address)
{
Trace.TraceInformation("AddHub: " + address);
// create a connection to a hub
var hubConnection = new HubConnection(address);
hubConnection.Headers.Add("ORLEANS", "GRAIN");
var hub = hubConnection.CreateHubProxy("playerHub");
await hubConnection.Start();
hubs.Add(address, new Tuple<HubConnection, IHubProxy>(hubConnection, hub));
}
@ChrisRisner
ChrisRisner / ManifestPermissions.xml
Last active August 29, 2015 14:06
Android Push Notifications with Notification Hubs
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<permission android:name="PACAKGE.permission.C2D_MESSAGE" android:protectionLevel="signature" />
@ChrisRisner
ChrisRisner / appdelegate.m
Last active August 29, 2015 14:05
iOS Push Notifications with Notification Hubs
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
return YES;
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSLog(@"APN device token: %@", deviceToken);
NSString *deviceTokenString = [NSString stringWithFormat:@"%@",deviceToken];
@ChrisRisner
ChrisRisner / NewClaim.js
Last active August 29, 2015 14:00
AzureAuthUpdate
'urn:microsoft:credentials': {
accessToken: ‘mytoken’
}
@ChrisRisner
ChrisRisner / MessageInsert.js
Last active August 29, 2015 13:59
Build 2013 Code gists
function insert(item, user, request) {
request.execute({ success: function() {
request.respond(200, item);
var azure = require('azure');
var hub = azure.createNotificationHubService(process.env.NOTIFICATION_HUB_NAME,
process.env.NOTIFICATION_HUB_FULL_ACCESS_SIGNATURE);
var payload = { message: 'New message: ' + item.Text};
var tags = '';
if (item.Recipient !== '')
tags = item.Recipient;