Skip to content

Instantly share code, notes, and snippets.

View JichunMa's full-sized avatar
🎯
Focusing

TwoDogSon JichunMa

🎯
Focusing
  • BeiJing,China
View GitHub Profile
@JichunMa
JichunMa / numdump_helper.py
Last active November 20, 2022 07:51
Mac numdump helper (need: Python3)
import os
import time
COMPLETE_FILE_DIR = './done/'
# 文件名两边添加双引号
def str_transform(source):
return '\"{}\"'.format(source)
package com.example.learnkotlin
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
/**
* Created on 2020/4/29.
// ==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==
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))
#! /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 / gist:a341be60974e822f55a3b7ab508efe65
Created July 12, 2017 16:06
The solution of Practice11PieChartView
package com.hencoder.hencoderpracticedraw1.practice;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
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 August 3, 2018 03:07
shell 命令执行截图保存桌面(支持自动删除)
#! /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 08:34
自定义类indexOf规则自实现方方式(修改equals方法时一定要修改hashCode方法)
@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;
}
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',