Skip to content

Instantly share code, notes, and snippets.

View zjuchenyuan's full-sized avatar

ChenYuan zjuchenyuan

View GitHub Profile
@joeyespo
joeyespo / app.py
Last active May 5, 2017 04:56
Example XSS with the new `|tojson` behavior in Flask 0.10
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
# Expected value
ids = [u"one", u"two's", u'"three"']
@ImSingee
ImSingee / jack.py
Created April 15, 2018 10:53
「加减大师」游戏攻略
import re
import json
from mitmproxy import ctx
from urllib.parse import quote
from pprint import pformat
def response(flow):
path = flow.request.path
if path == '/index/index_one_nine_two/make_question':
ctx.log.info('Start')
"""
say you have a private repo, which is not suitable for push to github
but you want github to show your activity for this repo
so, this script will help you sync commit message to `githubrepo`, using empty commits
used commands:
git log --all '--pretty=format:%ad|%s'
git commit -m "message" --date "Sun Jun 17 12:48:07 2018 +0800" --allow-empty
"""
@chichunchen
chichunchen / wget 中文亂碼
Created January 26, 2015 18:40
用 wget 从服务器下载文件经常遇到中文文件名变成乱码的问题。
reference: http://m13253.blogspot.tw/2013/04/solve-corrupted-chinese-filename-for-wget.html
其实不必要像那样修改源代码,wget 的 man 页面里就有解决方法。
正解是参数 --restrict-file-names=nocontrol
Update: +筱百合 提供了他的 ~/.wgetrc 文件,方便大家借鉴:
# 不要乱转义中文
--restrict-file-names=nocontrol
# 使用重定向后的文件名
--trust-server-names=on
@fzls
fzls / batch_exchange.py
Last active May 8, 2019 14:43
cc98上发帖批量散魔力值的辅助脚本
import re
import requests
from bs4 import BeautifulSoup
# 赠送的网址(post)
exchange_url = "http://www.nexushd.org/mybonus.php?action=exchange"
# 98的帖子网址
cc98_url = "http://www.cc98.org/dispbbs.asp"
@sudodoki
sudodoki / sharedWorker.js
Created August 10, 2013 11:43
Shared worker demo: proof of concept that different tabs can exchange messages using SharedWorker (so far isn't that spread (caniuse.com/#feat=sharedworkers)[http://caniuse.com/#feat=sharedworkers]
var clients = new Array();
clients.length = 0;
var broadcast = function(clients, message) {
var length = clients.length,
element = null;
for (var i = 0; i < length; i++) {
port = clients[i];
port.postMessage(message);
}
// 程序启动器[win32]
// 一个小玩意,作用就是读取与 exe 同名的 .config 文件,并逐条并行执行,不显示窗口
// 以 # 打头的行忽略
// 用于开机挂载一些自带 cmd 窗口的程序
// 自用 vs2017 编译测试通过
// ver 1.1
// 一个新语法:@命令 可以等待此命令结束后再继续运行
// 例如 @ping 127.1 -n 3 等待3秒
@amitsaha
amitsaha / pi_mp.py
Created March 14, 2012 12:02
Parallel Pi Calculation using Python's multiprocessing module
''' listing 6: pi_mp.py
Multiprocessing based code to estimate the value of PI
using monte carlo sampling
Ref: http://math.fullerton.edu/mathews/n2003/montecarlopimod.html
Uses workers:
http://docs.python.org/library/multiprocessing.html#module-multiprocessing.pool
'''
import random
@0xYYY
0xYYY / RUG.md
Last active October 14, 2021 04:09
SaturnBeam Finance - A 10M USD RUG on Moonriver

A 10M USD RUG on Moonriver

Warning: The following analysis may contain incorrect information, please verify everything yourself before believing in these info.

Would be nice to have someone better in on-chain analysis to double check these.

Background

SatrunBeam Finance was a yield aggregator on Moonriver, a EVM-Compatible parachain on Kusama in the Polkadot ecosystem.

It attracted several millions of liquidity within a month. The team is anon and they claimed that the contracts are audited by BitRise whose domain name was only registered on 2022-08-22 (https://who.is/whois/bitriseaudits.com). And the contracts were never actually verified on the block explorer.

@mgeeky
mgeeky / vm-auto-snapshot.sh
Last active July 24, 2022 20:15
Script to manage auto-snapshots for specified VirtualBox VM. Able to rotate snapshots, create, restore and delete ones.
#!/bin/bash
# vim: ts=4 sw=4 et
#
# Auto-snapshotting script intended to be cron'ed,
# taking automatic snapshots of particular VM, logging that actions,
# and providing means of restoring specific snapshots.
# Included with functionality of rotating them (like logrotate).
#
# Example cron entry for this script: