Skip to content

Instantly share code, notes, and snippets.

View KireinaHoro's full-sized avatar

Pengcheng Xu KireinaHoro

View GitHub Profile

Keybase proof

I hereby claim:

  • I am kireinahoro on github.
  • I am jsteward (https://keybase.io/jsteward) on keybase.
  • I have a public key ASCypnQpx7M1XKuNLom2T-j8tjksa9stJNI_fQSTykwuNQo

To claim this, I am signing this object:

@KireinaHoro
KireinaHoro / voodoops2-mission-control.json
Created January 10, 2018 15:52
VoodooPS2 Touchpad Mappings for Mission Control and Exposé
{
"title": "VoodooPS2 Touchpad Mappings for Mission Control and Exposé",
"rules": [
{
"description": "Change Control+Command+Up to Control+Up",
"manipulators": [
{
"from": {
"key_code": "up_arrow",
"modifiers": {
@KireinaHoro
KireinaHoro / mvcompleted.sh
Created January 11, 2018 17:55
mvcompleted.sh to pair with aria2
#!/bin/bash
# $1 is gid.
# $2 is the number of files.
# $3 is the path of the first file.
DOWNLOAD=/home/jsteward/aria2
#COMPLETE=/home/jsteward/gcscache
LOG=/home/jsteward/aria2/mvcompleted.log
SRC=$3
@KireinaHoro
KireinaHoro / weechat-relay
Last active January 15, 2018 05:06
service file for weechat relay
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
need net localmount
after bootmisc
}
checkconfig() {
@KireinaHoro
KireinaHoro / aria2
Created January 15, 2018 06:49
service file for aria2
#!/sbin/openrc-run
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
need net localmount
after bootmisc
}
start() {
@KireinaHoro
KireinaHoro / query_files.go
Last active May 4, 2021 16:11
Query Google Drive files with Golang
// slice of dictates for query
var q []string
//q = append(q, fmt.Sprintf("mimeType='%s'", driveFolderType))
//q = append(q, "name='Uncategorized'")
//q = append(q, "('0B9P4nJCkns_fWERqT3dfVENHMXM' in parents)")
q = append(q, "trashed=false")
q = append(q, "(name contains 'VCB')")
// construct the call for listing the requested files
listCall := srv.Files.List().PageSize(10).
@KireinaHoro
KireinaHoro / Constitution.diff
Created February 25, 2018 10:20
PRC Constitution Revision Advisory proposed on 2018-02-25, source http://www.xinhuanet.com/politics/2018-02/25/c_1122451187.htm
diff --git a/a/Constitution.txt b/b/Constitution.txt
index 5029997..53cff34 100644
--- a/a/Constitution.txt
+++ b/b/Constitution.txt
@@ -38,17 +38,17 @@
  中华人民共和国成立以后,我国社会逐步实现了由新民主主义到社会主义的过渡。生产资料私有制的社会主义改造已经完成,人剥削人的制度已经消灭,社会主义制度已经确立。工人阶级领导的、以工农联盟为基础的人民民主专政,实质上即无产阶级专政,得到巩固和发展。中国人民和中国人民解放军战胜了帝国主义、霸权主义的侵略、破坏和武装挑衅,维护了国家的独立和安全,增强了国防。经济建设取得了重大的成就,独立的、比较完整的社会主义工业体系已经基本形成,农业生产显著提高。教育、科学、文化等事业有了很大的发展,社会主义思想教育取得了明显的成效。广大人民的生活有了较大的改善。
-  中国新民主主义革命的胜利和社会主义事业的成就,是中国共产党领导中国各族人民,在马克思列宁主义、毛泽东思想的指引下,坚持真理,修正错误,战胜许多艰难险阻而取得的。我国将长期处于社会主义初级阶段。国家的根本任务是,沿着中国特色社会主义道路,集中力量进行社会主义现代化建设。中国各族人民将继续在中国共产党领导下,在马克思列宁主义、毛泽东思想、邓小平理论和“三个代表”重要思想指引下,坚持人民民主专政,坚持社会主义道路,坚持改革开放,不断完善社会主义的各项制度,发展社会主义市场经济,发展社会主义民主,健全社会主义法制,自力更生,艰苦奋斗,逐步实现工业、农业、国防和科学技术的现代化,推动物质文明、政治文明和精神文明协调发展,把我国建设成为富强、民主、文明的社会主义国家。
+  中国新民主主义革命的胜利和社会主义事业的成就,是中国共产党领导中国各族人民,在马克思列宁主义、毛泽东思想的指引下,坚持真理,修正错误,战胜许多艰难险阻而取得的。我国将长期处于社会主义初级阶段。国家的根本任务是,沿着中国特色社会主义道路,集中力量进行社会主义现代化建设。中国各族人民将继续在中国共产党领导下,在马克思列宁主义、毛泽东思想、邓小平理论、‘三个代表’重要思想、科学发展观、习近平新时代中国特色社会主义思想指引下,坚持人民民主专政,坚持社会主义道路,坚持改革开放,不断完善社会主义的各项制度,发展
@KireinaHoro
KireinaHoro / miller-rabin.rkt
Created March 8, 2018 11:03
Miller-Rabin algorithm for testing for primes
#lang racket
; modified expmod used in Miller-Rabin test that returns
; '(0 . #t) on discovering a non-trivial square root of
; 1 modulo n
(define (mr-expmod base exp m)
(cond ((= exp 0) (cons 1 false))
((even? exp)
(let ((res (mr-expmod base (/ exp 2) m)))
(if (cdr res) res
#include <cstdlib>
#include <iostream>
using namespace std;
#if 0
int strlen(const char *s) {
int i = 0;
for (; s[i]; ++i);
return i;
}
class Weapon {
public:
virtual bool usable() const = 0;
virtual double attack() = 0;
};
class Sword : public Weapon {
private:
constexpr static auto startRatio = 0.2;
constexpr static auto wearRatio = 0.8;