Skip to content

Instantly share code, notes, and snippets.

View xavieryao's full-sized avatar

Peiran Yao xavieryao

View GitHub Profile
@xavieryao
xavieryao / typing.py
Created February 7, 2017 02:12
Always typing
import time
from telethon import InteractiveTelegramClient
from telethon.tl.types.input_peer_chat import InputPeerChat
from telethon.tl.functions.messages.set_typing import SetTypingRequest
from telethon.tl.types.send_message_typing_action import SendMessageTypingAction
client = InteractiveTelegramClient('session_name','+8613400000000',api_id=123456,api_hash='752f79bb39d8004006f00f761dab7f00')
peer = InputPeerChat(14884418)
act = SendMessageTypingAction()
@xavieryao
xavieryao / word.py
Last active December 27, 2016 11:51
word.py
#!/usr/bin/env python3
import csv
import re
import requests
import argparse
def main(args):
with open(args.input, 'r') as in_list, open(args.output, 'w') as out:
writer = csv.writer(out)
words_lines = [x.strip() for x in in_list.readlines()]
publickey:
EB2A38568661887FA180BDDB5CABD5F21C7BFD59C090CB2D245A87AC253062882729293E5506350508E7F9AA3BB77F4333231490F915F6D63C55FE2F08A49B353F444AD3993CACC02DB784ABBB8E42A9B1BBFFFB38BE18D78E87A0E41B9B8F73A928EE0CCEE1F6739884B9777E4FE9E88A1BBE495927AC4A799B3181D6442443
plain:
1438871975 EK8NU4
12345678
base64:
sXbou35GY7H3aSvoHMAzUida/sHhD57l/KUJT5iOJya2KcuFrizCEudTIaQQU7ITj0DiR3xWcctTW9d/YvL5Dtc8aYXifnxisN5USeZ+DWVl6wKrYXB2uFkMCuY1aXxGPayYQh/2Jpy6gqqmTvvZW3HCG02ZeXwvdz8NW8kI+Zc=
base16:
de19b3e4315088744395ceb34562be7ada250-946c3451f0-2c793745b584fd942527e4fdadf8c3b9a1d4a569a78749db8036d6c3f209e7e1d8099ff8ba5453789c896286dab2f2ddd715e7298bf3607f01bb5368a12c2e4fbd6339881961f10665f626ac-3e4f4f46af5d7177aea380344c4000a3a61efaa3e217808bd2-1d9bf
{"retcode":"20","reason":"\u8bf7\u8f93\u5165\u6b63\u786e\u7684\u767b\u5f55\u540d"}
@xavieryao
xavieryao / bf_gen.coffee
Created April 12, 2015 13:16
Brainfuck DSL
code = ''
pos = 0
offset = 10
reg = (n)->
offset + n
moveTo = (dest)->
diff = dest-pos
@xavieryao
xavieryao / makeup.coffee
Last active August 29, 2015 14:01
Automatically and randomly change weibo avatar
# Automatically change avatar!
# This is magical!
# Xavier Yao 2014-05-10 Sat
# Don't forget to install request (`npm install request')
fs = require 'fs'
request = require 'request'
date = new Date()
@xavieryao
xavieryao / MontyHallProblem.js
Created October 2, 2013 05:35
Programming implementation of Monty Hall Problem.
/*
* Programming implementation of Monty Hall Problem.
* By Prof.X (http://weibo.com/xavieryao)
*/
//Variants to store experiment time and result.
var time = 0.0;
var changeAndWin = 0.0;
var winWithoutChange = 0.0;
@xavieryao
xavieryao / MineField.java
Last active December 19, 2015 09:39
Minesweeper Map Creator
package com.paperairplane.minesweeper.minetest;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Random;
/**
*
* @author Xavier Yao
* @see <a href="http://weibo.com/xavieryao">Xavier Yao's Sina Weibo </a>