Skip to content

Instantly share code, notes, and snippets.

View jonfriesen's full-sized avatar
🪐
hey there!

Jon Friesen jonfriesen

🪐
hey there!
View GitHub Profile
@jonfriesen
jonfriesen / totp.ps1
Last active March 17, 2024 19:44
TOTP Client for PowerShell
#requires -version 2
<#
.SYNOPSIS
Time-base One-Time Password Algorithm (RFC 6238)
.DESCRIPTION
This is an implementation of the RFC 6238 Time-Based One-Time Password Algorithm draft based upon the HMAC-based One-Time Password (HOTP) algorithm (RFC 4226). This is a time based variant of the HOTP algorithm providing short-lived OTP values.
.NOTES
Version: 1.0
function getWhoIsServer(domain) {
var host = '';
dns.resolveCname(server, function(err, addresses)
{
console.log(err);
if(!err) {
host = addresses[0];
} else {
console.log('Using alternate server '+server);
host = server;
@jonfriesen
jonfriesen / linkedlist.php
Created July 23, 2014 05:31
PHP Linked List
<!--
Filename: linkedlist.php
Creation Date: July 22, 2014
Purpose: Create a basic linked list
-->
<?php
class Node
{
private $object;
@jonfriesen
jonfriesen / OwinFileServerControl.cs
Last active June 12, 2016 03:53
Creates a http file server, if /exit is called server is shutdown
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Owin.Hosting;
using Owin;
using Microsoft.Owin.FileSystems;
using Microsoft.Owin.StaticFiles;
using System.Threading;
package Lab08;
import java.util.Random;
public class AirlineStandbyQueue {
private SortedListAdaptablePriorityQueue<Integer, Passenger> q;
public static void main(String[] args)
{
new AirlineStandbyQueue();
}
/** Inner class for entries */
protected static class MyEntry<K,V> implements Entry<K,V> {
protected K k; // key
protected V v; // value
public MyEntry(K key, V value) {
k = key;
v = value;
}
// methods of the Entry interface
public K getKey() { return k; }
@jonfriesen
jonfriesen / gist:5424952
Created April 20, 2013 06:10
Playing with events and delegates. I'm having difficulty wrapping my head around the entire concept... From what I gathered everything revolves around the delegate concept. Events reference the delegate as the type, and when they are triggered they must use the same parameters that the delegate has. The delegate links the event to the code that …
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
delegate void TaskUpdateHandler(object sender, EventArgs e); // Why does this have to be outside of the namespace?
namespace DelegatesEventsLambda
{