Skip to content

Instantly share code, notes, and snippets.

@markekraus
markekraus / GetInboxRuleReport.ps1
Last active Jan 31, 2019
Generates Multi-Threaded Office 365 Inbox Rule Report That Scales with the Number of Service Accounts Provided
View GetInboxRuleReport.ps1
using namespace System.Collections.Concurrent
$StartDate = [datetime]::UtcNow
# can be generated with something like
# 1..10 | %{ Get-Credential} | Export-CliXml -path 'C:\reports\InboxRules\Creds.xml'
# Which will prompt for credentials 10 times and store them in the xml file
$CredentialFile = 'C:\reports\InboxRules\Creds.xml'
$RunDate = $StartDate.ToString('o') -replace ':'
# This is the path of the CSV file. It is imperative that this file not be
# access while the script is running
@tonetheman
tonetheman / find_radio.py
Created Sep 27, 2020
find a radio button to click on
View find_radio.py
URI = "https://www.16personalities.com/free-personality-test"
from selenium.webdriver import Chrome, ChromeOptions
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
@brianmfear
brianmfear / AWS.apxc
Last active Jan 5, 2021
AWS SQS Methods, in Apex Code.
View AWS.apxc
public abstract class AWS {
// Post initialization logic (after constructor, before call)
protected abstract void init();
// XML Node utility methods that will help read elements
public static Boolean getChildNodeBoolean(Dom.XmlNode node, String ns, String name) {
try {
return Boolean.valueOf(node.getChildElement(name, ns).getText());
} catch(Exception e) {
return null;
@ShayMe21
ShayMe21 / MyViewController.cs
Created Jul 31, 2018
Xamarin with Auth0 and TouchID Authentication
View MyViewController.cs
// https://github.com/auth0-community/auth0-xamarin-oidc-samples/tree/master/Quickstart/01-Login/iOS
using System;
using UIKit;
using Auth0.OidcClient;
using System.Text;
using LocalAuthentication;
using Foundation;
using Xamarin.Auth;
@Xeoncross
Xeoncross / ngrams.go
Last active Mar 29, 2021
Simple golang ngrams, bigrams, trigrams, and just plain word pair counter from any given slice of strings.
View ngrams.go
package main
import (
"fmt"
"math"
"strings"
"unicode"
)
// SplitOnNonLetters splits a string on non-letter runes
@TheCloudScout
TheCloudScout / dockerfile
Created Nov 4, 2019
adsha-windowsservercore-ltsc2019-dotnet-4.8
View dockerfile
# escape=`
FROM mcr.microsoft.com/windows/servercore:ltsc2019
# Install .NET 4.8
RUN curl -fSLo dotnet-framework-installer.exe https://download.visualstudio.microsoft.com/download/pr/7afca223-55d2-470a-8edc-6a1739ae3252/abd170b4b0ec15ad0222a809b761a036/ndp48-x86-x64-allos-enu.exe `
&& .\dotnet-framework-installer.exe /q `
&& del .\dotnet-framework-installer.exe `
&& powershell Remove-Item -Force -Recurse ${Env:TEMP}\*
@bobbychopra
bobbychopra / AddColumn.ps1
Created Oct 9, 2012
Add Date column to an existing csv file
View AddColumn.ps1
$today = [System.DateTime]::Today.ToString("yyyyMMdd")
Import-Csv -Header Column1,Column2 -Delim ',' 'C:\sample.csv' |
ForEach {
New-Object psobject -Property @{Date=$today;Col1=$_.Column1; Col2=$_.Column2}
} | Select-Object Date,Col1,Col2 | Export-Csv -NoTypeInformation 'C:\sample.csv'
@pankaj28843
pankaj28843 / set_outer_border_for_range_xlsx.py
Last active May 28, 2021
A simple hack - set outer border for a range using xlsxwriter, a Python library
View set_outer_border_for_range_xlsx.py
from __future__ import absolute_import
try:
import cStringIO as StringIO
except ImportError:
import StringIO
# Standard Library
import re
import string
@rszeto
rszeto / *pycharm-setup-2020.3.2.md
Last active Aug 12, 2021
Setting up PyCharm project with remote interpreter
View *pycharm-setup-2020.3.2.md

Setting up PyCharm project with remote interpreter

Setting up a remote interpreter on PyCharm is awfully unintuitive. I've pared it down to what I think is the minimal number of steps, and leaves the fewest number of deployment configurations and Python interpreters lying around. This is designed for my specific configuration (specifically PyTorch); adapt as needed.

Configuring default project (only do after installing PyCharm for the first time):

  1. (Optional) Add virtual environment path to excluded files
    1. From Welcome Page, go to Configure > Settings > Build, Execution, Deployment > Deployment > Options
    2. Add virtualenv path. For example, if you always have the project's virtualenv in .env, add ";.env" to the "Exclude items by name" field
@rivo
rivo / postgres.go
Last active Aug 12, 2021
A demo Go application (a PostgreSQL database browser) highlighting the use of the rivo/tview package. See https://github.com/rivo/tview/wiki/Postgres
View postgres.go
package main
import (
"database/sql"
"fmt"
"net/url"
"os"
"reflect"
"regexp"
"strconv"