Skip to content

Instantly share code, notes, and snippets.

const SLEEP_TIME_MS = 50;
// for example, if this is 0.001 we will click randomly every ~1000 loops
const RANDOM_CLICK_CHANCE = 0.1;
const NUM_LOOPS = 1;
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
function sample(array) {
return array[Math.floor(Math.random() \* array.length)];
}
{
body: {
cards: [
{
assetKey: "AdaptiveMutation",
attack: 0,
cardSubType: "法术",
cardType: "Spell",
cost: 2,
description: "<b>Consume</b>.
{
"kind":"Listing",
"data":{
"modhash":"efcjl3c06z0e2283337f6740c827247e8c53bd9ede3a5220a6",
"dist":4,
"children":[
{
"kind":"t1",
"data":{
"total_awards_received":0,
Traceback (most recent call last):
File "bin/limbo", line 17, in <module>
main(args)
File "/home/limbo/.virtualenvs/limbo/local/lib/python2.7/site-packages/limbo/limbo.py", line 292, in main
loop(server)
File "/home/limbo/.virtualenvs/limbo/local/lib/python2.7/site-packages/limbo/limbo.py", line 180, in loop
events = server.slack.rtm_read()
File "/home/limbo/.virtualenvs/limbo/local/lib/python2.7/site-packages/limbo/slack.py", line 75, in rtm_read
data = [json.loads(d) for d in self.websocket_safe_read()]
File "/home/limbo/.virtualenvs/limbo/local/lib/python2.7/site-packages/limbo/slack.py", line 187, in websocket_safe_read
In [16]: def count(total_so_far, increment):
...: return total_so_far + increment
...:
In [19]: count(count(count(0, 1), 1), 1)
Out[19]: 3
In [11]: class Counter():
...: def __init__(self):
...: self.__counter = 0
...:
...: def count(self, increment):
...: self.__counter += increment
...: return self.__counter
...:
...:
@topher200
topher200 / gist:3771e62acde6145df658b4576cbdd33f
Last active May 6, 2016 01:25
python decorator timing testing
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@topher200
topher200 / gist:99927146c4ecec754bb3
Created October 14, 2015 07:04
ipython notebook for int to string python
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"I've never made an ipython notebook before. Seemed like it might be fun!\n",
"\n",
"The first section is re-implementing the ones from your email."
]
@topher200
topher200 / gist:fcbe11cd61af5a6994c9
Created July 9, 2015 18:57
zmq testing. incrementing ports
20150709T184328.482 INFO: this process pid: 11068
20150709T184328.486 INFO: creating socket
20150709T184328.487 DEBUG: socket made connection
20150709T184328.487 DEBUG: closing socket
20150709T184328.838 INFO: this process pid: 3748
20150709T184328.844 INFO: creating socket
20150709T184328.845 DEBUG: socket made connection
20150709T184328.845 DEBUG: closing socket
20150709T184329.217 INFO: this process pid: 5940
20150709T184329.221 INFO: creating socket
@topher200
topher200 / gist:fe1a88b6b1db105ae073
Created July 3, 2015 22:03
zeromq port in use before bind error and resolution
20150703T215627.744 INFO: launching script
20150703T215627.750 DEBUG: system call: python create_zmq_bind_socket.py -v
20150703T215628.164 DEBUG: 20150703T215628.130 INFO: this process pid: 11308
20150703T215628.134 INFO: creating socket
20150703T215628.138 INFO: Current socket status: sconn(fd=-1, family=2, type=1, laddr=('0.0.0.0', 50099), raddr=(), status='LISTEN', pid=11308)
20150703T215628.164 INFO: launching script
20150703T215628.171 DEBUG: system call: python create_zmq_bind_socket.py -v
20150703T215629.463 DEBUG: 20150703T215628.494 INFO: this process pid: 6776
20150703T215628.497 ERROR: Found this net connection before connect: sconn(fd=-1, family=2, type=1, laddr=('127.0.0.1', 50099), raddr=('127.0.0.1', 55999), status='SYN_SENT', pid=11436)
20150703T215628.499 INFO: creating socket