This file contains hidden or 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 hmac | |
import hashlib | |
import time | |
access_token = 'access_token' | |
app_secret = 'app_secret' | |
time = int(time.time()) | |
hmac_secret = app_secret.encode() | |
hmac_data = (access_token+'|'+str(time)).encode() | |
app_secret_proof=hmac.new(hmac_secret,hmac_data,hashlib.sha256).hexdigest() | |
print('Time:', time) |
This file contains hidden or 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
param( | |
[Parameter(Mandatory=$true, HelpMessage='Path for your Workplace access token in .json format {"accessToken" : 123xyz}')] [string]$WPAccessToken, | |
[Parameter(Mandatory=$false, HelpMessage='Page size for SCIM requests. Defaults to 100.')] [int]$SCIMPageSize = 100 | |
) | |
$defJobs = { | |
$origin = New-Object -Type DateTime -ArgumentList 1970, 1, 1, 0, 0, 0, 0 | |
function Get-Status { | |
If(-Not $_.active) {return "Deactivated"} |
This file contains hidden or 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
param( | |
[Parameter(Mandatory=$true, HelpMessage='Path of the user export with the list of the users you would like to activate')] [string]$WPExportedUsers, | |
[Parameter(Mandatory=$true, HelpMessage='Path for your Workplace access token in .json format {"accessToken" : 123xyz}')] [string]$WPAccessToken, | |
[switch]$Interactive | |
) | |
#Install ImportExcel Module | |
If(!(Get-module ImportExcel)){Install-Module ImportExcel -scope CurrentUser} | |
#Read JSON Access Token |
This file contains hidden or 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
param( | |
[Parameter(Mandatory=$true, HelpMessage='The ID of the Workplace Group you would like to remove users from')] [string]$GroupId, | |
[Parameter(Mandatory=$false, HelpMessage='The domain of the users you would like to remove')] [string]$EmailDomain, | |
[Parameter(Mandatory=$false, HelpMessage='Path to your file listing users to remove from group')] [string]$WPGroupMembers, | |
[Parameter(Mandatory=$true, HelpMessage='Path to your Workplace access token in .json format {"accessToken" : 123xyz}')] [string]$WPAccessToken, | |
[Parameter(Mandatory=$false, HelpMessage='Mode you would like to run the tool in: {Test (default), Live, Live-Force}')] [string]$Mode = 'Test' | |
) | |
#Read JSON Access Token | |
try { |
This file contains hidden or 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
param( | |
[Parameter(Mandatory=$true, HelpMessage='The ID of the Workplace Group you would like to export')] [string]$GroupId, | |
[Parameter(Mandatory=$true, HelpMessage='Path for your Workplace access token in .json format {"accessToken" : 123xyz}')] [string]$WPAccessToken | |
) | |
#Install ImportExcel Module | |
If(!(Get-module ImportExcel)){Install-Module ImportExcel -scope CurrentUser} | |
#Read JSON Access Token | |
try { |
This file contains hidden or 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
param( | |
[Parameter(Mandatory=$true, Position=0, HelpMessage='Path for your Workplace export file')] [string]$WPExportedUsers, | |
[Parameter(Mandatory=$true, Position=1, HelpMessage='Path for your Workplace access token in .json format {"accessToken" : 123xyz}')] [string]$WPAccessToken, | |
[switch]$Interactive | |
) | |
#Install ImportExcel Module | |
If(!(Get-module ImportExcel)){Install-Module ImportExcel -scope CurrentUser} | |
#Read JSON Access Token |
This file contains hidden or 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
#Connect to O365 Admin | |
Connect-MSolService | |
#Get company name | |
$accountSkus = Get-MsolAccountSku | |
$companyName = $accountSkus.AccountSkuId[0].split(":")[0] | |
$Office365ProPlusSku = $companyName + ":OFFICESUBSCRIPTION" | |
$Office365E3Sku = $companyName + ":ENTERPRISEPACK" | |
$Office365E3SkuServicePlansWithoutProPlus = "BPOS_S_TODO_2","FORMS_PLAN_E3","STREAM_O365_E3","Deskless","FLOW_O365_P2","POWERAPPS_O365_P2","TEAMS1","PROJECTWORKMANAGEMENT","SWAY","INTUNE_O365","YAMMER_ENTERPRISE","RMS_S_ENTERPRISE","MCOSTANDARD","SHAREPOINTWAC","SHAREPOINTENTERPRISE","EXCHANGE_S_ENTERPRISE" | |
#Get all licensed users - You can add more filters Get-MsolUser -All <more filters, e.g. -Department "Sales" -UsageLocation "US" | |
$x = Get-MsolUser -All | where {$_.isLicensed -eq $true} |
This file contains hidden or 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
const dir = require('node-dir'); | |
var jimp = require("jimp"); | |
const args = process.argv; | |
dir.promiseFiles(args[2]) | |
.then(files => { | |
for(let file of files) { | |
jimp.read(file).then(image => { | |
image | |
.quality(60) |
This file contains hidden or 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 java.io.*; | |
import java.util.*; | |
public class HackerCupQualR2 { | |
public static void main(String[] args) { | |
Scanner in = new Scanner(System.in); | |
int times = in.nextInt(); | |
for(int i = 1; i <= times; i++) { | |
int l = in.nextInt(); |
This file contains hidden or 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
# use stored credential or ask for new one | |
$useStoredCredsIfAvailable = $True | |
# credsFile location | |
$CredsFile = "./AuthKey" | |
# check if creds file exists | |
$FileExists = Test-Path $CredsFile | |
If(-not $useStoredCredsIfAvailable -or $useStoredCredsIfAvailable -and -not $FileExists){ |
NewerOlder