Skip to content

Instantly share code, notes, and snippets.

View simonkuang's full-sized avatar

Simon Kuang simonkuang

  • Chengtu, P.R.China
View GitHub Profile
@simonkuang
simonkuang / tweet-login.js
Created May 7, 2020 06:59
查询 twitter 登录页面中,用户名、密码框、登录按钮在页面中位置的脚本
window["setPosition"] = (...args) => { console.log(args); };
window["jsperform"] = (...args) => { console.log(args); };
// 探测登录页面中,用户名文本框、密码文本框和登录按钮的位置
;(function() {
// 退出前做的工作
var exit = () => {
// 通知机器人 js 执行完毕
window.jsperform("login");
}, setPosition = (x, y) => {
@simonkuang
simonkuang / aesgcm.py
Last active April 2, 2020 02:45
从 chrome 本地文件中解密获取 chrome 中保存的 cookie(支持到 Chrome80)
# -*- coding: utf-8 -*-
"""
pip install cryptography
"""
import os
import sys
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import (Cipher, algorithms, modes)
@simonkuang
simonkuang / docker-compose.yml
Last active March 27, 2020 03:49
elasticsearch 的 docker-compose.yml 脚本。不要直接用,供借鉴。
# Only used for testing the docker images
# from: https://github.com/elastic/elasticsearch/blob/master/distribution/docker/docker-compose.yml
version: '3.4'
services:
elasticsearch-default-1:
image: elasticsearch:test
environment:
- node.name=elasticsearch-default-1
- cluster.initial_master_nodes=elasticsearch-default-1,elasticsearch-default-2
- discovery.seed_hosts=elasticsearch-default-2:9300
@simonkuang
simonkuang / sign_apk.sh
Created March 12, 2020 11:56
给 android apk 做签名的步骤
#!/bin/bash
ANDROID_VERSION=29.0.2
[ "x$ANDROID_HOME" = "x" ] && ANDROID_HOME=/data/android/sdk
APKSIGNER=$ANDROID_HOME/build-tools/$ANDROID_VERSION/bin/apksigner
keytool -genkeypair -keystore debug.keystore -alias debug -validity 36500 -keyalg RSA -keysize 2048
#keytool -list -v -keystore debug.keystore
$APKSIGNER sign --v2-signing-enabled false --ks debug.store xxx.apk
@simonkuang
simonkuang / coredns.php
Created March 3, 2020 17:03
根据 gfwlist 生成 dns 污染的域名列表。用于 coredns 配置
<?php
function parse($str) {
$s = ltrim($str, '|@.');
$host = null;
if (false !== strpos($s, '//')) {
$url = parse_url($s);
if (!empty($url['host'])) {
$host = $url['host'];
}
@simonkuang
simonkuang / Dockerfile
Last active February 5, 2020 07:54
从 php:7.3-fpm 开始的镜像 build file
FROM php:7.3-fpm
MAINTAINER Simon Kuang<me@simonkuang.com>
RUN ([ -f /etc/apt/sources.list ] && mv /etc/apt/sources.list /etc/apt/sources.list.bak) \
&& echo "# Tsinghua Tuna Mirror" > /etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ buster main non-free contrib" >> /etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main" >> /etc/apt/sources.list \
&& echo "deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security buster/updates main" >> /etc/apt/sources.list \
&& echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ buster-updates main non-free contrib" >> /etc/apt/sources.list \
@simonkuang
simonkuang / retrieve_rpm.sh
Created August 12, 2019 11:38
Retrieve rpm packages for offline yum repo using docker.
#!/bin/bash
_DIR=$(cd "$(dirname "$0")";pwd)
cd $_DIR
## ============== retrieve rpms and prepare repo meta data
yum install -y createrepo
_ID=$(docker run --rm centos:7.2.1511 /bin/bash -c "sleep 10800")
export _ID
@simonkuang
simonkuang / pyenv.sh
Created August 9, 2019 13:19
Install pyenv in CentOS
#!/bin/bash
yum install -y epel-release
yum install -y gcc gcc-c++ glibc glibc-devel curl git \
libffi-devel sqlite-devel bzip2-devel bzip2 readline-devel
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | /bin/bash
cat <<EOF >> $HOME/.bashrc
# Load pyenv automatically by adding
# the following to ~/.bash_profile:
export PATH="/root/.pyenv/bin:\$PATH"
@simonkuang
simonkuang / find-windows-names.sh
Last active July 29, 2019 05:35
to resolve the windows names of PCs in local network
#!/bin/bash
# Only for MacOS
brew install nmap
for i in $(nmap -p3389 192.168.1.0/24 | grep -B5 "3389/tcp open" | grep "report for" | awk "{print \$5}"); do
echo $i: $(smbutil status $i | awk '!(NR%3){print $2}')
done
windows CMD命令大全及详细解释和语法
引用:
http://letle.iteye.com/blog/169045
http://www.cppblog.com/kyelin/archive/2007/04/21/22540.aspx
windows批处理程序中的特殊字符
批处理介绍
纯以dos系统而言,可执行程序大约可以细分为五类,依照执行优先级由高到低排列分别是:
DOSKEY宏命令(预先驻留内存)