This file contains 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 requests | |
import json | |
import os | |
data = { | |
'email': '[email protected]', | |
'password': '', | |
'app_name': 'radio_android', | |
'version': '606', | |
} |
This file contains 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 cv2 | |
import numpy as np | |
canny = rho = threshold = minLen = maxGap = None | |
def draw(): | |
lines = cv2.HoughLinesP(canny, rho, np.pi / 180, | |
threshold, None, minLen, maxGap) | |
dst = cv2.cvtColor(canny, cv2.COLOR_GRAY2BGR) |
This file contains 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
# http://five.flash-gear.com/npuz/puz.php?c=z&o=2&id=4349105&k=17041499&s=15&w=420&h=555&f_dm=five | |
data = open('puz.swf', 'rb').read() | |
mark = '\xff\xd8\xff\xe0\x00\x10JFIF' | |
t=data.split(mark) | |
for i, d in enumerate(t): | |
if 'CREATOR' in d: | |
open('%d.jpeg'%i, 'wb').write(mark + d) |
This file contains 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 Text.Parsec | |
import Text.Parsec.Expr | |
import Text.Parsec.Language (emptyDef) | |
import Text.Parsec.String (Parser) | |
import qualified Text.Parsec.Token as P | |
lexer = P.makeTokenParser emptyDef | |
parens = P.parens lexer | |
number :: Parser Double |
This file contains 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 Data.Maybe (fromMaybe) | |
import Data.List (intercalate) | |
data Tree a = Tree {left :: Tree a, right :: Tree a, val :: a} | |
| Nil deriving (Eq) | |
instance (Eq a, Show a) => Show (Tree a) where | |
show = toString | |
genPosTree :: (Show a, Eq a) => Tree a -> Int -> Tree (a, Int, Int, Maybe Int, Maybe Int) |
This file contains 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 requests | |
import base64 | |
from bs4 import BeautifulSoup | |
cookie = open('cookie163.txt').read().strip() | |
bookid = '23c816b98303491ab82e898d349f6154_4&tradeId=' | |
bookinfo = requests.get('http://yuedu.163.com/getBook.do?id='+bookid).json() | |
content = '' | |
for p in bookinfo['portions']: |
This file contains 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
from deap import base, creator, tools, algorithms | |
from random import randint, random, gauss | |
from PIL import Image, ImageDraw | |
from functools import partial | |
from math import sqrt | |
import numpy | |
PIC = Image.open('head.jpg') | |
SIZE = 100 |
This file contains 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
''' http://nbviewer.ipython.org/gist/anonymous/f5707335f40af9463c43 ''' | |
try: | |
import numpy as np | |
except: | |
import numpypy as np | |
def mandel(x, y, max_iters): | |
c = complex(x, y) | |
z = 0.0j |
This file contains 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
{-# OPTIONS_GHC -O2 -optc-O2 #-} | |
import Control.Monad | |
import Text.ParserCombinators.Parsec | |
import Control.Monad.State | |
import Data.Array.IO | |
import Data.Char | |
import Debug.Trace | |
data Stmt = INCPNT | DECPNT | INC | DEC | OUTPUT | READ | |
| Loop [Stmt] |
This file contains 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
ref: http://www'iwriteiam'nl/Ha_bf_intro'html | |
>++++++++++[<++++++++++>-] (#0=100) | |
>+++++++[<+++++++>-]+++++++++++<--< (#1=47 #2=11) | |
[ (loop #0) | |
>+ (inc #1) | |
>- (dec #2) | |
(test if #2 is 0 using #3 #4) | |
[>+>+<<-] >[<+>-] (move #2 to #3 #4; move #3 to #2) |