Skip to content

Instantly share code, notes, and snippets.

View danieleli's full-sized avatar

Dan Schlossberg danieleli

View GitHub Profile
@danieleli
danieleli / debugger.ps1
Last active May 9, 2024 21:44
Registry reader debugger
function Get-ComPortNames {
param (
[string]$VendorID,
[string]$ProductID
)
$pattern = "^VID_$VendorID.PID_$ProductID"
$rx = New-Object System.Text.RegularExpressions.Regex($pattern, [System.Text.RegularExpressions.RegexOptions]::IgnoreCase)
$comports = @()
$rk1 = [Microsoft.Win32.Registry]::LocalMachine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Win32;
namespace WorkstationId
{
class Program
@danieleli
danieleli / BolConstraint.cs
Last active October 25, 2018 03:04
SendBol
public class BolConstraint
{
public string Origin;
public string Destination;
public string CarrierId;
public DateTime PickupDate;
public DateTime Timestamp;
}
@danieleli
danieleli / sample.cs
Last active February 13, 2016 19:24
Extending Functions
public class Original
{
public string OldFunction(string s1, string s2)
{
return s1 + s2;
}
}
public class RobertsSolution
@danieleli
danieleli / MessageTo.cshtml
Created February 13, 2016 18:58
MessageTo
<h2>title</h2>
@ViewBag.SellerHandle
@using Microsoft.AspNet.Identity
<!-- do we have a user -->
@if (Request.IsAuthenticated)
{
<!-- we have user, so display user name. -->
<div class="username">
@User.Identity.GetUserName()
</div>
}
package paging
import "fmt"
// SearchWindow contains start and stop
// and a default method for spliting the
// window into smaller windows
type SearchWindow struct {
start int64
stop int64
ALTER FUNCTION [dbo].[Creative_Grid] (
@start DATETIME,
@end DATETIME,
@clientIds VARCHAR(MAX),
@seId VARCHAR(MAX) = null,
@campaignId VARCHAR(MAX) = null,
@adCategoryId VARCHAR(MAX) = null
)
RETURNS TABLE AS RETURN
public static class ReportExtensions
{
public static string Serialize(this Report report)
{
var stream = SerializeToStream(report);
var finalString = ReadStream(stream);
return finalString;
}
@danieleli
danieleli / app.config.xml
Created February 28, 2013 17:55
Mashery.Net sample config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Mashery.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<Mashery.Properties.Settings>
<setting name="ApiKey" serializeAs="String">