Skip to content

Instantly share code, notes, and snippets.

Avatar
😍
feel free

Smite Chow lovemyliwu

😍
feel free
View GitHub Profile
View write csv with utf8 bom.py
import binascii
file = open('douyin_signature.csv', 'wb')
bom = binascii.unhexlify(''.join("EF BB BF".split()))
file.write(bom)
file.write('unique_id,signature'.encode())
def get_signature(unique_id):
import requests
response = requests.get(f'https://www.iesdouyin.com/web/api/v2/user/info/?unique_id={unique_id}').json()
return response['user_info']['signature']
View dynamic bars manim.py
from manimlib.imports import *
class Stop(Exception):
def __init__(self, last_animations):
self.animations = last_animations
class Main(Scene):
current_month = 1
View manim 2d demo.py
from manimlib.imports import *
class Main(Scene):
def construct(self):
dot = Dot()
line = Line()
arrow = Arrow()
circle = Circle()
annulus = Annulus()
@lovemyliwu
lovemyliwu / demo.py
Created Nov 8, 2020
manim hello world
View demo.py
from manimlib.imports import *
class HelloWorld(Scene):
def construct(self):
hello_text = TextMobject(
"Hello World, from smite",
tex_to_color_map={
"World": YELLOW,
}
)
View analysis_flow_size_mitmproxy_demo.py
import json
from mitmproxy import ctx
from mitmproxy import command
class Analysis:
def __init__(self):
self.info = {}
View mitmproxy_addson_demo.py
from mitmproxy import ctx
class Replacer:
def __init__(self):
self.num = 0
def response(self, flow):
self.num = self.num + 1
flow.response.content = flow.response.content.replace('知道'.encode(), '知道个屁'.encode())
@lovemyliwu
lovemyliwu / test.ruby
Created Jun 13, 2020
ruby call/cc demo
View test.ruby
require 'continuation'
def strange
callcc { |cont| return cont }
print "Back in method, "
end
print "Before method. "
c = strange()
print "After method. "
c.call if c
@lovemyliwu
lovemyliwu / fsmcr_demo.py
Created May 30, 2020
FSM CR demo alternative to call/cc generator(yield)
View fsmcr_demo.py
"""
有限状态机CR demo
"""
import inspect
import random
import threading
from _thread import _local
import dill as pickle
from functools import partial
View geojson_amap.html
<html>
<title>照片元信息转换为GeoJSON数据并可视化</title>
<style>
.thumb, canvas {
height: 75px;
border: 1px solid #000;
margin: 10px 5px 0 0;
}
#container {
View simplex.py
def print_variable(basic_idx, none_basic_idx):
b_name = [f'x_{i+1}' for i in basic_idx]
nb_name = [f'x_{i+1}' for i in none_basic_idx]
print(f'基变量有:{b_name}, 非基变量有:{nb_name}')
def get_matrix_for_exchange(none_basic_idx, exchange_none_basic_index):
A = np.array([
[1, 2, 1, 0, 0],