Skip to content

Instantly share code, notes, and snippets.

View yinheli's full-sized avatar
👋
我在寻找新的工作机会,欢迎和我联系

yinheli yinheli

👋
我在寻找新的工作机会,欢迎和我联系
View GitHub Profile
@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 / ecb.go
Last active November 9, 2022 11:33
golang 标准库不支持 AES/ECB/PKCS5Padding issues: https://code.google.com/p/go/issues/detail?id=5597 别人的补丁. https://codereview.appspot.com/7860047/
package main
import (
"crypto/cipher"
)
type ecb struct {
b cipher.Block
blockSize int
}
@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). 根据语境不同意义有所区别,但一般都是还没搞定的意思
@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++);
@yinheli
yinheli / isayme.xcs
Created September 1, 2014 15:24 — forked from isayme/isayme.xcs
[isayme]
text(bold)=eaeaea
magenta(bold)=ff00ff
text=ffffff
white(bold)=eaeaea
green=00c000
red(bold)=d20000
green(bold)=00ff00
black(bold)=808080
red=c00000
@yinheli
yinheli / v2ex_daily.go
Last active December 2, 2019 20:49
领取 v2ex 每日奖励 golang
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"regexp"
"strings"
)
@yinheli
yinheli / T.java
Created September 24, 2015 17:33
java 生成图片, 从资源文件加载字体, 并且抗锯齿
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
/**
* @author yinheli
*/
public class T {
import java.math.BigInteger;
import java.util.function.Function;
/**
* @author yinheli
*/
public class RSATest {
private static BigInteger[] commonE = new BigInteger[]{