Skip to content

Instantly share code, notes, and snippets.

# code mostly from by https://nathancahill.com/duo-cli
import plistlib
# enable backup in Duo app w/ encryption, set ascii password and enter here.
# if you do not want to write the password to disk, instead of saving this
# file, start iPython, copy the code, and type %paste into the prompt
password = b'xxx'
# off an encrypted backup of your phone, get the app's
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World!'
@anfedorov
anfedorov / poolqueue.py
Last active November 3, 2019 14:16
Use multiprocessing's primitives to process events while also extending the Queue
from time import sleep
from multiprocessing import Queue, JoinableQueue, Process
class PoolQueue(object):
def __init__(self, n):
self.num_procs = n
self.procs = []
self.payloads = JoinableQueue()
self.results = Queue()
# $OpenBSD: sshd_config,v 1.101 2017/03/14 07:19:07 djm Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
@anfedorov
anfedorov / -
Created September 9, 2015 19:45
import numpy as np
import struct
def read(f, s, offset=0):
return struct.unpack(f, s[offset:offset+struct.calcsize(f)])
def read_files(imgf, labelf):
def check_group(S, O, check_abelian=False):
"""Checks group properties on set S and operation O.
Arguments:
S (set): elements of this group
O (callable): operation on two elements of S, returns an element of S
check_abelian (bool): check if this is an abelian group
"""
# check that S is closed under O
"""Prisoners in hats problem
N prisoners are notified that they will be playing a game tomorrow morning.
First they will stand in a circle and close their eyes.
Hats of one of N colors will be put on their heads (hat colors may repeat).
They will open their eyes and see the colors of everyone else's hat.
They will close their eyes and simultaneously guess what their own hat color is.
If any one of them guesses correctly, they all go free.
Otherwise they all die.
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1 (0x1)
Signature Algorithm: sha1WithRSAEncryption
Issuer: C=SE, O=AddTrust AB, OU=AddTrust External TTP Network, CN=AddTrust External CA Root
Validity
Not Before: May 30 10:48:38 2000 GMT
Not After : May 30 10:48:38 2020 GMT
Subject: C=SE, O=AddTrust AB, OU=AddTrust External TTP Network, CN=AddTrust External CA Root

Keybase proof

I hereby claim:

  • I am anfedorov on github.
  • I am anfedorov (https://keybase.io/anfedorov) on keybase.
  • I have a public key whose fingerprint is 51D5 B1BD A66B 2146 716F CBC3 63C0 13D2 659D A87E

To claim this, I am signing this object:

<link rel="import" href="../ace-element/ace-element.html">
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../core-menu-button/core-menu-button.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-animated-pages/core-animated-pages.html">
<link rel="import" href="../core-animated-pages/transitions/hero-transition.html">
<link rel="import" href="../core-animated-pages/transitions/cross-fade.html">
<link rel="import" href="../core-animated-pages/transitions/slide-down.html">
<link rel="import" href="../core-animated-pages/transitions/slide-up.html">