This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
import ayah | |
ayah.configure( | |
settings.AREYOUHUMAN_PUBLISHER_KEY, | |
settings.AREYOUHUMAN_SCORING_KEY, | |
) | |
from django.forms import Field, ValidationError, Form | |
from django.forms.widgets import Widget |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.decorators import login_required | |
from django.utils.decorators import method_decorator | |
from django.views.generic import TemplateView | |
class LoginRequiredMixin(object): | |
@method_decorator(login_required) | |
def dispatch(self, *args, **kwargs): | |
return super(LoginRequiredMixin, self).dispatch(*args, **kwargs) | |
class LoginRequiredTemplateView(LoginRequiredMixin,TemplateView): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import transaction | |
from django.test.testcases import disable_transaction_methods, restore_transaction_methods | |
from django.core import mail | |
class TransactionTest(object): | |
def setUp(self): | |
transaction.enter_transaction_management() | |
transaction.managed(True) | |
disable_transaction_methods() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var searchHighLow = function(v,f,min,max) { | |
var t, dat; | |
for (;;) { | |
dat = f(min); | |
if(dat === v) return [min,min]; | |
t = (min + max) >> 1; | |
dat = f(t); | |
if(dat === v) return [t,t]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-Mailbox -resultsize unlimited |ForEach-Object { | |
$u = $_ | Get-User | |
if ($u.Lastname.length -gt 1 -and $u.FirstName.length -gt 0) { | |
$new = (($u.FirstName) + ($u.LastName.Substring(0,1))).tolower() + "@example.com" | |
Set-Mailbox $_.id -EmailAddress @{add=$new} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$LiveCred = Get-Credential | |
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic -AllowRedirection | |
Import-PSSession $Session |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$users = Get-MsolUser -All | ?{ $_.isLicensed -eq "TRUE" } | |
$sku = "tenent:SMB_BUSINESS_PREMIUM" | |
$users | ?{ ($_.Licenses | ?{ $_.AccountSkuId -eq $sku}).Length -gt 0} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module MSOnline | |
$cred = Get-Credential | |
Connect-MsolService –Credential $cred |
OlderNewer