Skip to content

Instantly share code, notes, and snippets.

@sabbour
sabbour / test.txt
Created January 30, 2014 11:48
Testing Gist
Hello
@sabbour
sabbour / IdentityModels.cs
Last active August 29, 2015 14:03
Adding the Country Code, Phone and PIN properties to the ApplicationUser model
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
namespace MFAAuth.Models
{
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
public class ApplicationUser : IdentityUser
{
@sabbour
sabbour / AccountsViewModels.cs
Last active August 29, 2015 14:03
Adding the Country Code, Phone and PIN properties to the RegisterViewModel model
public class RegisterViewModel
{
[Required]
[EmailAddress]
[Display(Name = "Email")]
public string Email { get; set; }
[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
@sabbour
sabbour / Register.cshtml
Created July 14, 2014 13:40
Adding the Phone and PIN properties to the Register view
@model MFAAuth.Models.RegisterViewModel
@{
ViewBag.Title = "Register";
}
<h2>@ViewBag.Title.</h2>
@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { @class = "form-horizontal", role = "form" }))
{
@Html.AntiForgeryToken()
@sabbour
sabbour / AccountController.cs
Created July 14, 2014 14:35
Augmenting the Login method with calls to the MFA provider
//
// POST: /Account/Login
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
{
if (ModelState.IsValid)
{
var user = await UserManager.FindAsync(model.Email, model.Password);
@sabbour
sabbour / AccountController.cs
Last active March 15, 2017 19:32
Augmenting the Register method to pass on the Country Code, PIN and Phone number to the Application User
//
// POST: /Account/Register
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Register(RegisterViewModel model)
{
if (ModelState.IsValid)
{
var user = new ApplicationUser() { UserName = model.Email, Email = model.Email, CountryCode = mode.CountryCode, PIN = model.PIN, Phone = model.Phone };
#!/bin/bash
# update-openvpn-certs.sh
/usr/local/openvpn_as/scripts/sacli --key "cs.priv_key" --value_file "/etc/letsencrypt/live/<YOUR DOMAIN NAME>/privkey.pem" ConfigPut
/usr/local/openvpn_as/scripts/sacli --key "cs.cert" --value_file "/etc/letsencrypt/live/<YOUR DOMAIN NAME>/fullchain.pem" ConfigPut
/usr/local/openvpn_as/scripts/sacli --key "cs.ca_bundle" --value_file "/etc/letsencrypt/live/<YOUR DOMAIN NAME>/chain.pem" ConfigPut
/usr/local/openvpn_as/scripts/sacli start
@sabbour
sabbour / fix-dslr-teams.sh
Last active December 16, 2020 18:54
Fix Teams DSLR WebCam on Mac OS
# gist=<rawurl>
# curl -o fix-dslr-teams.sh $gist && chmod +x fix-dslr-teams.sh && sudo ./fix-dslr-teams.sh
#!/bin/bash
echo "Removing signatures"
sudo codesign --remove-signature "/Applications/Microsoft Teams.app" && \
sudo codesign --remove-signature "/Applications/Microsoft Teams.app/Contents/MacOS/Teams" && \
sudo codesign --remove-signature "/Applications/Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper.app" && \
sudo codesign --remove-signature "/Applications/Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper (GPU).app" && \
sudo codesign --remove-signature "/Applications/Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper (Plugin).app" && \
sudo codesign --remove-signature "/Applications/Microsoft Teams.app/Contents/Frameworks/Microsoft Teams Helper (Renderer).app"
@sabbour
sabbour / Web.config
Last active March 23, 2022 20:37
Magento IIS Web.config for URL Rewriting
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Remove index.php rule" stopProcessing="true">
<match url=".*" ignoreCase="false"/>
<conditions>
<add input="{URL}" pattern="^/(media|skin|js)/" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
@sabbour
sabbour / aro-create.sh
Created January 24, 2023 19:13
Create an Azure Red Hat OpenShift cluster
LOCATION=eastus # the location of your cluster
RESOURCEGROUP=aro-rg # the name of the resource group where you want to create your cluster
CLUSTER=asabbour # the name of your cluster
az group create \
--name $RESOURCEGROUP \
--location $LOCATION
az network vnet create \
--resource-group $RESOURCEGROUP \