Skip to content

Instantly share code, notes, and snippets.

@djsmith42
djsmith42 / action.js
Last active January 29, 2024 15:30
ObservePoint Pre-audit action for TOTP tokens for MFA/2FA
const TOTP_KEY = 'Pate your TOTP key here. Example: 5ep5abbzomzpen2fpti6hhyu5i'
const CSS_SELECTOR = 'Paste your CSS selector here for the TOTP token input. Example: #totp_token'
// ----------------------------------------------------------------------------
// Do not change code below this line
// ----------------------------------------------------------------------------
totp(TOTP_KEY).then(token => {
const element = document.querySelector(CSS_SELECTOR)
FLIP = 7
FLOP = 8
print("Player Count\tMinimum N for all to play")
for player_count in range(1, 100000):
got_to_play = set()
direction = 1
player = 0
n = 0
while len(got_to_play) < player_count:
~/Dev/Sandbox  python flipflop.py
With 1 players, ALL players played
With 2 players, ALL players played
With 3 players, ALL players played
With 4 players, ALL players played
With 5 players, ALL players played
With 6 players, ALL players played
With 7 players, ALL players played
With 8 players, ALL players played
With 9 players, ALL players played
for player_count in range(1, 10000):
got_to_play = set()
direction = 1
player = 0
for n in range(1, 1000000):
got_to_play.add(player)
if got_to_play == set(range(player_count)):
break
if n % 7 == 0 and n % 8 == 0: # flip flop
direction = -direction
# -*- coding: UTF-8 -*-
DAYS_OF_THE_WEEK = {
"en_US": {"Sunday": 0, "Monday": 1, "Tuesday": 2, "Wednesday": 3, "Thursday": 4, "Friday": 5, "Saturday": 6},
"es_ES": {"Domingo": 0, "Lunes": 1, "Martes": 2, "Miercoles": 3, "Jueves": 4, "Viernes": 5, "Sabado": 6},
"ja_JP": {"日曜日": 0, "月曜日": 1, "火曜日": 2, "水曜日": 3, "木曜日": 4, "金曜日": 5, "土曜日": 6},
}
REVERSE_DAYS_OF_THE_WEEK = dict((locale, dict(map(reversed, days.items())))
for locale, days in DAYS_OF_THE_WEEK.items())
function createFoo(foo) {
// 3rd party lib
return newFooId
}
function deleteFoo(fooId) {
// 3rd party lib
}
function doTheThing() {
const obj = {foo: 1, bar: 2, biz: 3, baz: 4}
const x = subset(obj, ['foo', 'baz'])
// x == {foo: 1, baz: 4}
// Angular 1.2+
function sendReq(config, reqData) {
/* SNIP */
if (isUndefined(cachedResp)) {
var xsrfValue = urlIsSameOrigin(config.url)
? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]
: undefined;
from celery import app
app.control.broadcast('my_custom_command')
from celery.worker.control import Panel
@Panel.register
def my_custom_command(*args):
print('Yay, my custom command just ran!')