Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

TwoDogSon JichunMa

🎯
Focusing
Block or report user

Report or block JichunMa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:6f503c933325391727262750bc9e1069
// ==UserScript==
// @name Phabricator copy
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://code.yangqianguan.com/D*
// @grant none
// ==/UserScript==
View gist:513abc505d8ca41811f79b93c4a8c0de
def check_contains_blank(source):
if not source:
raise ValueError("source is None")
regular = r"\s"
pattern = re.compile(regular)
result = pattern.search(test_str)
if result is not None:
raise ValueError("{} can't contains whitespace".format(source))
View 截图脚本
#! /bin/bash
dir=~/Desktop/screenshot/
curr=`date "+%Y-%m-%d %H:%M:%S"`
name=${dir}"screenshot"${curr}".png"
echo "${name}"
adb start-server
adb exec-out screencap -p > "$name"
if [ -n "$1" ]; then
echo "$1 秒后自动删除"
sleep $1
@JichunMa
JichunMa / numdump_helper.py
Last active Apr 1, 2019
Mac numdump helper (need: Python3)
View numdump_helper.py
import os
import time
COMPLETE_FILE_DIR = './done/'
# 文件名两边添加双引号
def str_transform(source):
return '\"{}\"'.format(source)
View gist:af08d9c24a2fbd527fe6bf2ec3c84c27
headers = {
"Connection": "keep-alive",
"Pragma": "no-cache",
"Cache-Control": "no-cache",
"Upgrade-Insecure-Requests": 1,
"DNT": 1,
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "en,zh-CN;q=0.9,zh;q=0.8"
@JichunMa
JichunMa / gist:f11c947513014581c043f34f539e6093
Last active Aug 3, 2018
shell 命令执行截图保存桌面(支持自动删除)
View gist:f11c947513014581c043f34f539e6093
#! /bin/bash
dir=~/Desktop/screenshot/
curr=`date "+%Y-%m-%d %H:%M:%S"`
name=${dir}"screenshot"${curr}".png"
echo "${name}"
adb exec-out screencap -p > "$name"
if [ -n "$1" ]; then
echo "$1 秒后自动删除"
sleep $1
rm "$name"
@JichunMa
JichunMa / gist:13343ab0d09b787f3061ce1e96701ba5
Created May 23, 2018
自定义类indexOf规则自实现方方式(修改equals方法时一定要修改hashCode方法)
View gist:13343ab0d09b787f3061ce1e96701ba5
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AreaBean labelBean = (AreaBean) o;
if (label != null ? !label.equals(labelBean.label) : labelBean.label != null) return false;
return value != null ? value.equals(labelBean.value) : labelBean.value == null;
}
View gist:c2ce28c21def0eda0e700db847d39850
def insert_mysql(list_items):
if len(list_items) == 0:
print('input data illegal')
return
config = {
'host': '127.0.0.1',
'port': 3306,
'user': 'root',
'password': '********',
'db': 'lagouInfo',
View gist:21e8f36d5cd0e11df90afc527e8a669e
detail_data = ''
// 详情页网址 https://www.toutiao.com/a6539663078324175367/
//我把头条详情页存到了本地 toutiao_detai.html
with open('toutiao_detai.html', 'r')as f:
detail_data = f.read()
data_list = re.findall("articleInfo: {(.*?)}", detail_data, re.S)
for data in data_list:
url_list = re.findall('(http.*?com)', text, re.S)
for url in url_list:
print(url)
View gist:b33e9ec04400aad215f809bb2c402f2f
import re
def remove_all_whitespace(source_str):
p = re.compile('\s+')
new_string = re.sub(p, '', source_str)
return new_string
You can’t perform that action at this time.