Skip to content

Instantly share code, notes, and snippets.

View yinheli's full-sized avatar
🎯
Focusing

yinheli yinheli

🎯
Focusing
View GitHub Profile
@yinheli
yinheli / output
Last active September 9, 2024 02:21
My mini desk PC, state
SMART Information for /dev/nvme0n1
--------------------------------------------------
| Metric | Value |
| -------------------- | ------------------------- |
| Temperature | 46 |
| Data Written | 4.38 TB |
| Data Read | 30.9 TB |
| Power On Hours | 19 |
--------------------------------------------------
Temperature Sensors: 50, 51, 52, 53, 54, 55, 56, 57
@yinheli
yinheli / Android_Emulator_AWS_EC2_ARM64_2022.txt
Created June 26, 2023 05:56 — forked from atyachin/Android_Emulator_AWS_EC2_ARM64_2022.txt
Running headless android emulator on AWS EC2 Ubuntu instance (ARM64 / aarch64) - 2022
Android Emulator (ARM64) on EC2 - 2022
---------------------------------------
1. Launch EC2 ARM based Instance (a1.metal / a1.2xlarge): (16 Gb RAM, 32Gb Disk), Ubuntu Server 22.04 LTS (HVM) ARM x64
2. sudo apt update && sudo apt upgrade
3. sudo apt install default-jdk python3-pip repo python-is-python3 unzip libpcre2-dev adb
4. wget https://dl.google.com/android/repository/commandlinetools-linux-8512546_latest.zip
5. unzip commandlinetools-linux-8512546_latest.zip -d android-sdk
6. sudo mv android-sdk /opt/
7. mkdir /opt/android-sdk/cmdline-tools/latest
8. mv /opt/android-sdk/cmdline-tools/* /opt/android-sdk/cmdline-tools/latest (ignore the error)
@yinheli
yinheli / compress_pdf.md
Created April 20, 2022 11:15 — forked from ahmed-musallam/compress_pdf.md
How to compress PDF with ghostscript

How to compress PDF using ghostscript

As a developer, it bothers me when someone sends me a large pdf file compared to the number of pages. Recently, I recieved a 12MB scanned document for just one letter-sized page... so I got to googlin, like I usually do, and found ghostscript!

to learn more abot ghostscript (gs): https://www.ghostscript.com/

What we are interested in, is the gs command line tool, which provides many options for manipulating PDF, but we are interested in compressign those large PDF's into small yet legible documents.

credit goes to this answer on askubuntu forum: https://askubuntu.com/questions/3382/reduce-filesize-of-a-scanned-pdf/3387#3387?newreg=bceddef8bc334e5b88bbfd17a6e7c4f9

#[cfg(test)]
mod tests_lifetime {
use std::future::Future;
async fn f(_x: &i32) {
()
}
// 写法 1
@yinheli
yinheli / short.md
Last active January 20, 2021 09:00
Codereview 中常见的缩写
TL;DR: Too Long; Don’t Read. PR 内容太多,没办法看
PR:Pull Request. 拉取请求,给其他项目提交代码
PTAL:Please take a look. 请看一看
LGTM: Looks Good To Me. 代码已经过 review,可以合并
SGTM: Sounds Good To Me. 和上面那句意思差不多,也是已经通过了 review 的意思
WIP: Work In Progress. 告诉项目维护者这个功能还未完成,方便维护者前 review 已提交的代码
PTAL: Please Take A Look. 提示项目 Owner/contributor review
TBR: To Be Reviewed. 提示维护者进行 review
TBD: To Be Done (or Defined/Discussed/Decided/Determined). 根据语境不同意义有所区别,但一般都是还没搞定的意思
import java.math.BigInteger;
import java.util.function.Function;
/**
* @author yinheli
*/
public class RSATest {
private static BigInteger[] commonE = new BigInteger[]{
@yinheli
yinheli / SSLPoke.java
Created December 14, 2016 03:55 — forked from 4ndrej/SSLPoke.java
Test of java SSL / keystore / cert setup. Check the commet #1 for howto.
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
@yinheli
yinheli / run.sh
Created March 25, 2016 17:12 — forked from andreas-marschke/run.sh
Small example LUA script for wg/wrk using a tiny JSON implementation(http://regex.info/blog/lua/json) to log test results to a file.
# Example usage with several configuration sets as in multiple connections durations and threads.
# You may go take the rest of the day off while this will run ;)
for duration in 10s 1m 10m 1h
do
for connections in 100 200 300 400 500 600
do
for thread in 1 2 3 4 5
do
wrk -d$duration -c$connections -t$thread -s wrk-script.lua http://localhost:4001/beacon/0001/demo-load-test/test/web
@yinheli
yinheli / file
Created February 25, 2016 07:42
freedom_public
{"0.15388708864338696":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgMEywWiPIt/xn6y9RmhhJ2u29WhuNE3mxct\r\nmBPun89q3vI2bsDDXT6yc8QBslPaE3XWXkr7N1ykXrwgjpVfAAkVBs3/AAAACDxn\r\naXRodWI+wv8AAACNBBATCAA//wAAAAWCVs6wWv8AAAACiwn/AAAACZDcNlEK8wxb\r\nef8AAAAFlQgJCgv/AAAAA5YBAv8AAAACmwP/AAAAAp4BAAA+XwD+LqIXxuH0i4Wo\r\nPstbZGTGrcvuKKqaXdd6JhCRhnO+u5wBAITxX5G9VZU6p3Pybw1y0e5h4jkieDND\r\nrT7ItECBfTbuzv8AAABWBAAAAAASCCqGSM49AwEHAgMElSBHEyqPc7+b+quUZmMN\r\nNd21FQoyt2BVfwgH7FRttkwgDg0/Rp8hv9Ym+D0qCV/7qfcZX0exkutY9eG0iXz4\r\nFQMBCAfC/wAAAG0EGBMIAB//AAAABYJWzrBa/wAAAAmQ3DZRCvMMW3n/AAAAApsM\r\nAAA49AEAydCVMjqGeAfzETbZv5dtZ+LoSQopNAYjSG5Gekc2biQA+wf6XQe8j1vt\r\n0Myv/BNzCpqHSlBUAwTicWrqKYJ+PBB7\r\n=q6fo\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n"}
@yinheli
yinheli / batch_delete_tencent_tweet.js
Created February 3, 2016 08:35
批量删除腾讯微博
// 批量删除广播
(function(){
var list = $$('#talkList>li');
var count = list.length
console.log('list length', count);
var t = 0
var idx = 0
list.forEach(function(i){
setTimeout(function() {
console.log("delete id", i.id, 'idx:', idx++);