Skip to content

Instantly share code, notes, and snippets.

@Ekus
Ekus / ApprovalController.cs
Created September 29, 2021 16:07
Add "page executed" timer to all asp.net views
// make all your MVC controllers inherit this one instead of System.Web.Mvc.Controller directly
using System.Web.Mvc;
using System.Diagnostics;
public class ApprovalController : Controller
{
static NLog.Logger log = NLog.LogManager.GetCurrentClassLogger();
protected override void OnActionExecuting(ActionExecutingContext ctx)
@Ekus
Ekus / web.config
Created March 15, 2019 20:34
web.config - allow testing .asmx from remote browsers
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<webServices> <!-- allow testing .asmx from remote browsers -->
<protocols>
<add name="HttpGet" />
<add name="HttpPost" />
</protocols>
</webServices>
</system.web>
@Ekus
Ekus / EkusTVRemote.ino
Created January 12, 2016 03:01
Arduino sketch that sends an IR signal to turn Samsung TV on/off every time it receives a byte (any byte) using serial connection.
#include <IRremote.h>
IRsend irsend;
//samsung tv power on/off
unsigned int S_pwr[68]={4600,4350,700,1550,650,1550,650,1600,650,450,650,450,650,450,650,450,700,400,700,1550,650,1550,650,1600,650,450,650,450,650,450,700,450,650,450,650,450,650,1550,700,450,650,450,650,450,650,450,650,450,700,400,650,1600,650,450,650,1550,650,1600,650,1550,650,1550,700,1550,650,1550,650};
void setup()
{
Serial.begin(9600);
}
@Ekus
Ekus / EkusTV.aspx
Last active April 21, 2018 16:49
An ASP.NET page that controls Arduino using USB to Serial connection. I use it to have the Arduino send an IR signal that turns my TV on/off. I use Amazon Echo to send a GET request to this page when I say "Alexa, turn on/off the TV"
<%@ Page Language="C#" AutoEventWireup="true" %>
<%@Import Namespace="System.IO.Ports" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
using (SerialPort sp = new System.IO.Ports.SerialPort())
{
sp.PortName = "COM3";
sp.BaudRate = 9600;