Skip to content

Instantly share code, notes, and snippets.

View c1982's full-sized avatar
🍄
yeah!

Oğuzhan Yılmaz c1982

🍄
yeah!
View GitHub Profile
using System.Web.Mvc;
namespace MvcApplication1.Models
{
public class CheckBrowserAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
base.OnActionExecuted(filterContext);
}
using System.Web.Mvc;
using System.Web.Routing;
using MvcApplication1.Models;
namespace MvcApplication1
{
public class MvcApplication : System.Web.HttpApplication
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
using System.Web.Mvc;
namespace MvcApplication1.Models
{
public class LoginRequiredAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
if (filterContext.HttpContext.Session["isLogIn"] == null)
filterContext.Result = new RedirectResult("~/Home/Login");
@c1982
c1982 / gist:847125
Created February 28, 2011 09:26
Mikrotik API: Add Static Firewall Rule
using Mikrotik.Api;
namespace Usage
{
class Program
{
static void Main(string[] args)
{
var variable = new Firewall("192.168.2.8", "admin", "password")
.Chain(Targets.forward)
@c1982
c1982 / gist:847133
Created February 28, 2011 09:32
Create Backup, Change Identity, Login Notice, Reboot
using Mikrotik.Api;
namespace Usage
{
class Program
{
static void Main(string[] args)
{
//TODO : Create Mikrotik backup
var variable = new RouterOs("192.168.2.8", "admin", "password")
@c1982
c1982 / gist:847137
Created February 28, 2011 09:37
Add new user, disable, enable and remove Mikrotik user.
using Mikrotik.Api;
namespace Usage
{
class Program
{
static void Main(string[] args)
{
//TODO : Add new user, disable, enable and remove Mikrotik user.
var variable = new Users("192.168.2.8", "admin", "password")
@c1982
c1982 / gist:856761
Created March 5, 2011 22:09
DynamicOverload Pattern
class Program
{
static void Main(string[] args)
{
var cmd = new Executor();
dynamic commandItem = RemoteServer.GetCommandItemFromRemoteServer(); //return Object;
cmd.ExecuteCommand(commandItem);
Console.ReadKey();
@c1982
c1982 / WhoisCommand.cs
Created December 13, 2011 14:26
PowerShell Whois Module
// Author: Oğuzhan YILMAZ
// Web : www.oguzhan.info
// Email : aspsrc@gmail.com
// 12/13/2011
namespace PoshWhois
{
using System;
using System.Collections.Generic;
using System.IO;
public void Before_1()
{
string Year = "";
string Month = "";
string Week = "";
string Day = "";
}
public void After_1()
{
string Year, Month, Week, Day = String.Empty;
}