Skip to content

Instantly share code, notes, and snippets.

Avatar
🍋
long long ago;

Harry Cheng chengyuhui

🍋
long long ago;
View GitHub Profile
View utf8_to_gb18030.rs
use std::io::prelude::*;
use std::{fs::File, path::PathBuf};
use encoding_rs::GB18030;
fn main() -> std::io::Result<()> {
let mut input_path = std::env::args().skip(1).next().map(PathBuf::from).unwrap();
let mut in_file = File::open(&input_path)?;
let mut src = String::new();
@chengyuhui
chengyuhui / git-credential-kwallet.py
Created Mar 30, 2020
KWallet wrapper for git credential helper
View git-credential-kwallet.py
#!/usr/bin/env python3
from sys import stdin, argv
import subprocess
import json
if len(argv) != 2:
print("Usage: " + argv[0] + " <action: get|store>")
exit(1)
action = argv[1]
View docker-compose.yml
version: '3.3'
services:
db:
image: mariadb:10.1
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
View crash.log
11-13 14:56:38.067 1787 1787 E AndroidRuntime: at org.mokee.mkparts.stats.ReportingServiceManager.setAlarm(ReportingServiceManager.java:67)
11-13 14:56:38.067 1787 1787 E AndroidRuntime: at org.mokee.mkparts.stats.ReportingServiceManager.launchService(ReportingServiceManager.java:107)
.. More than 40k lines of the same log above ..
11-13 14:58:52.098 3309 3309 D AndroidRuntime: Shutting down VM
11-13 14:58:52.099 3309 3309 E AndroidRuntime: FATAL EXCEPTION: main
11-13 14:58:52.099 3309 3309 E AndroidRuntime: Process: com.android.dialer, PID: 3309
11-13 14:58:52.099 3309 3309 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference
11-13 14:58:52.099 3309 3309 E AndroidRuntime: at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:445)
11-13 14:58:52.099 3309 3309 E AndroidRuntime: at android.widget.ArrayAdapter.getView(ArrayAdapter.java:407)
View logcat.log
02-18 12:48:27.673 20791 20791 W DataUsageController: Failed to open stats session
02-18 12:48:27.673 20791 20791 W DataUsageController: java.lang.IllegalStateException: Bandwidth module disabled
02-18 12:48:27.673 20791 20791 W DataUsageController: at android.os.Parcel.readException(Parcel.java:2012)
02-18 12:48:27.673 20791 20791 W DataUsageController: at android.os.Parcel.readException(Parcel.java:1950)
02-18 12:48:27.673 20791 20791 W DataUsageController: at android.net.INetworkStatsService$Stub$Proxy.openSession(INetworkStatsService.java:229)
02-18 12:48:27.673 20791 20791 W DataUsageController: at com.android.settingslib.net.DataUsageController.getSession(DataUsageController.java:92)
02-18 12:48:27.673 20791 20791 W DataUsageController: at com.android.settingslib.net.DataUsageController.getDataUsageInfo(DataUsageController.java:128)
02-18 12:48:27.673 20791 20791 W DataUsageController: at com.android.settings.datausage.DataUsagePreference.setTemplate(DataUsagePreference.java:44)
02-18 12:48:
View log.txt
Sun Jul 09 01:53:12 2017
Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Bootstrap to the start of init.init took 0.10s
Early init took 0.03s
Loader init took 0.04s
Loading error handling took 0.03s
Loading script took 0.63s
View soundcloud.conf
upstream soundcloud_main {
server 54.192.9.210:443;
server 54.192.27.193:443;
server 54.192.27.35:443;
server 54.192.27.27:443;
server 54.192.27.133:443;
server 54.192.27.150:443;
server 54.192.27.212:443;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am chengyuhui on github.
  • I am htdocscast (https://keybase.io/htdocscast) on keybase.
  • I have a public key whose fingerprint is 3473 8155 1AB4 0C38 2496 A241 5C37 09ED 45F4 E2CF

To claim this, I am signing this object:

View getPages.js
async getPages(){
// 由于API权限不足,无法获取R-18作品数据(即使已经登录且设置允许R-18)
// 暂时不使用API方式,改用DOM + AJAX
var pages = [];
if ($('._illust_modal').length !== 0) {
// 对于单张图片,可以直接在页面上的._illust_modal当中找到URL
let url = $('.original-image').data('src');
pages.push(url);
} else if ($('._ugoku-illust-player-container').length !== 0) {
// Ugoira(动图)
View t.js
// Create a random ID for this session.
var sessionId = String.fromCharCode(Date.now() % 25 + 97) +
Math.random().toString(36).slice(2); // From uBlock
var port = chrome.runtime.connect({name: sessionId}),
channels = [],
// For receiving responses.
resp = new require('events').EventEmitter();
class Channel {