Skip to content

Instantly share code, notes, and snippets.


JHSN Chrstm

Block or report user

Report or block Chrstm

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Chrstm /
Last active Apr 12, 2019
How to use array of general datatype in elasticsearch-dsl-py?
from elasticsearch_dsl import DocType, Index, Integer, Text, Q
from elasticsearch_dsl.connections import connections
import time
post_index = Index('test_post')
class PostDoc(DocType):
author_id = Integer() # List[Integer]
Chrstm /
Created Dec 2, 2018
recover python random state (Mersenne Twister)
import random
class MT19937Recover:
"""Reverses the Mersenne Twister based on 624 observed outputs.
The internal state of a Mersenne Twister can be recovered by observing
624 generated outputs of it. However, if those are not directly
observed following a twist, another output is required to restore the
internal index.
See also .
Chrstm /
Last active Aug 18, 2019
RSA LSB Oracle Attack
def lsb_oracle_attack(n, e, c, lsb_oracle):
RSA LSB Oracle Attack
:param lsb_oracle: lsb_oracle(x) == pow(x, d, n) % 2
:return: m or None if not found
l, r, k2 = 0, 1, 1
while n * l // k2 + 1 < n * r // k2:
m = l + r
l <<= 1
Chrstm / clean_up_codeforces_problemset.js
Created Feb 15, 2018
Clear easy problems of Codeforces Problemset
View clean_up_codeforces_problemset.js
// ==UserScript==
// @name Clean up Codeforces problemset
// @namespace
// @version 0.2
// @description Clear easy problems of Codeforces Problemset
// @author JHSN
// @match
// @match
// @match*
// @grant none
You can’t perform that action at this time.