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
#!/usr/bin/env python | |
# This example demonstrates RSA public-key cryptography in an | |
# easy-to-follow manner. It works on integers alone, and uses much smaller numbers | |
# for the sake of clarity. | |
##################################################################### | |
# First we pick our primes. These will determine our keys. | |
##################################################################### |
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 os | |
import random | |
deck = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]*4 | |
def deal(deck): | |
hand = [] | |
for i in range(2): | |
random.shuffle(deck) | |
card = deck.pop() |
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
## Ignore Visual Studio temporary files, build results, and | |
## files generated by popular Visual Studio add-ons. | |
################### | |
# compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe |
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
long squareAndMultiply(long base, unsigned short power) | |
{ | |
// x^0 = 1 | |
if (! power) return 1; | |
// x^1 = x | |
if (power == 1) return base; | |
// if power is odd | |
if (power % 2) |
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
# Simple Substitution Cipher | |
# http://inventwithpython.com/hacking (BSD Licensed) | |
import sys, random | |
LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' | |
def main(): | |
myMessage = 'When you do the common things in life in an uncommon way, you will command the attention of the world' | |
myKey = 'QWERTYUIOPASDFGHJKLZXCVBNM' |
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
#include "chess.h" | |
Square::Square() | |
{ | |
piece = EMPTY; | |
color = NONE; | |
} | |
void Square::setSpace(Square* space) |
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
[TestInitialize] | |
public void BeforeEach() | |
{ | |
_fixture = new Fixture(); | |
// client has a circular reference from AutoFixture point of view | |
_fixture.Behaviors.Remove(new ThrowingRecursionBehavior()); | |
_fixture.Behaviors.Add(new OmitOnRecursionBehavior()); | |
} |
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
// ==UserScript== | |
// @name EmuParadise Download Workaround - 1.1.1 | |
// @version 1.1.2 | |
// @description Replaces the download button link with a working one | |
// @author Eptun | |
// @match https://www.emuparadise.me/*/*/* | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js | |
// @grant none | |
// ==/UserScript== |
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 numpy as np | |
def encrypt(msg): | |
# Replace spaces with nothing | |
msg = msg.replace(" ", "") | |
# Ask for keyword and get encryption matrix | |
C = make_key() | |
# Append zero if the messsage isn't divisble by 2 | |
len_check = len(msg) % 2 == 0 |
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
""" | |
A minimal implementation of Monte Carlo tree search (MCTS) in Python 3 | |
Luke Harold Miles, July 2019, Public Domain Dedication | |
See also https://en.wikipedia.org/wiki/Monte_Carlo_tree_search | |
https://gist.github.com/qpwo/c538c6f73727e254fdc7fab81024f6e1 | |
""" | |
from abc import ABC, abstractmethod | |
from collections import defaultdict | |
import math |
OlderNewer