Skip to content

Instantly share code, notes, and snippets.

View coverband's full-sized avatar

coverband coverband

View GitHub Profile
#!/bin/bash
domain=$1
port=$2
if [ -z "$domain" ] || [ -z "$port" ]; then
echo "Usage: domain-alias <domain> <port>"
exit 1
fi
@deanhume
deanhume / GlobalSignalR.cs
Last active December 21, 2015 07:09
The Global.asax with a SignalR hub details added
private const string onlineUsersCacheKey = "OnlineUsers";
// The SignalR Hub
readonly UserActivityHub userActivityHub = new UserActivityHub();
/// <summary>
/// This method is fired when the application starts up.
/// </summary>
protected void Application_Start()
{
@deanhume
deanhume / SignalRHub.cs
Last active October 24, 2018 18:41
The SignalR user count hub
namespace UsersOnlineExample.Utils
{
using System.Collections.Generic;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;
[HubName("userActivityHub")]
public class UserActivityHub : Hub
{
@deanhume
deanhume / SignalRClientSide.html
Last active December 21, 2015 07:09
The SignalR client side code.
<div id="usersCount"></div>
<script src="~/Scripts/jquery-1.8.2.min.js"></script>
<script src="~/Scripts/jquery.signalR-1.1.3.js"></script>
<script src="/signalr/hubs" type="text/javascript"></script>
<script>
$(function () {
// Reference the auto-generated proxy for the hub.
var userActivity = $.connection.userActivityHub;
// Create a function that the hub can call back to display messages.
@codingoutloud
codingoutloud / make-keys.bat
Last active October 3, 2024 07:10
Handy OpenSSL command-line combinations I've used - they might've been hard to find or come up with, so capturing them here.
@echo off
if _%1_==__ goto USAGE
openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem -subj "/CN=My Cert Name"
openssl pkcs12 -export -out mycert.pfx -inkey mycert.pem -in mycert.pem -passout pass:%1
openssl x509 -inform pem -in mycert.pem -outform der -out mycert.cer
openssl pkcs12 -in mycert.pfx -nodes -passin pass:%1 | openssl x509 -noout -fingerprint
openssl x509 -in mycert.pem -noout -fingerprint
@paulmach
paulmach / serve.go
Last active June 20, 2025 14:26
Simple Static File Server in Go
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main
@yetithefoot
yetithefoot / stuns
Last active January 20, 2025 15:25 — forked from zziuni/stuns
STUN+TURN servers list
{url:'stun:stun01.sipphone.com'},
{url:'stun:stun.ekiga.net'},
{url:'stun:stun.fwdnet.net'},
{url:'stun:stun.ideasip.com'},
{url:'stun:stun.iptel.org'},
{url:'stun:stun.rixtelecom.se'},
{url:'stun:stun.schlund.de'},
{url:'stun:stun.l.google.com:19302'},
{url:'stun:stun1.l.google.com:19302'},
{url:'stun:stun2.l.google.com:19302'},
@chrisbloom7
chrisbloom7 / meet_chef_notes.md
Created March 19, 2014 19:55
Notes from the Meet Chef video tutorial at http://pluralsight.com/
@jszmajda
jszmajda / 1readme.md
Last active September 3, 2022 18:33
Data Serialization: JSON, MsgPack, ProtoBufs
@chrisveness
chrisveness / utf8-regex.js
Last active May 25, 2023 01:53
Utf8 string encode/decode using regular expressions
/**
* Encodes multi-byte Unicode string into utf-8 multiple single-byte characters
* (BMP / basic multilingual plane only).
*
* Chars in range U+0080 - U+07FF are encoded in 2 chars, U+0800 - U+FFFF in 3 chars.
*
* Can be achieved in JavaScript by unescape(encodeURIComponent(str)),
* but this approach may be useful in other languages.
*
* @param {string} unicodeString - Unicode string to be encoded as UTF-8.