Skip to content

Instantly share code, notes, and snippets.

View KireinaHoro's full-sized avatar

Pengcheng Xu KireinaHoro

View GitHub Profile
@KireinaHoro
KireinaHoro / arpa_inet_h-in_addr_t-definition.patch
Created July 24, 2018 17:23
Patch for Bionic headers for missing definition
--- arpa/inet.h.old 2018-07-25 00:19:42.423809828 +0800
+++ arpa/inet.h 2018-07-25 00:18:14.071813451 +0800
@@ -36,6 +36,8 @@
__BEGIN_DECLS
+typedef uint32_t in_addr_t;
+
in_addr_t inet_addr(const char* __s);
int inet_aton(const char* __s, struct in_addr* __addr);
@KireinaHoro
KireinaHoro / bootstrap.sh
Last active February 4, 2024 04:21
Bootstrap aarch64-linux-android clang/llvm toolchain with sanitizers support
#!/bin/bash
# script that creates clang/llvm cross toolchain for aarch64 android target
# compile a hello world program that runs on AOSP Android:
# test with: adb push hello /data/cache && adb shell /data/cache/hello
# GCC:
# C: aarch64-linux-android-gcc hello.c -o hello -pie
# C++: aarch64-linux-android-g++ hello.cc -o hello -pie -fPIC -static-libgcc \
# -nostdlib -L/usr/local/aarch64-linux-android/lib -lc++ -lc -nostdinc++ \
# -I/usr/local/aarch64-linux-android/include/c++/v1 -std=c++11
# Clang/LLVM:
@KireinaHoro
KireinaHoro / local.conf
Created July 14, 2018 01:44
Working fontconfig
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Turn off embedded font -->
<match target="font">
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
</match>
@KireinaHoro
KireinaHoro / main.py
Created May 19, 2018 08:26
FightTheLandlord
#!/usr/bin/env python
# FightTheLandlord Artificial Stupidity
# Version 0
# 2018 Pengcheng Xu, Junjie Shan, Zixin Zhou
# All rights reserved.
# TODO 判斷是用大牌打地主還是清理散牌
# TODO 給牌型排序(設計估值函數)
# TODO 計算打出牌型的分值
# TODO 儘量選長的牌出
{
"fonts": {
"MS UI Gothic": {
"replace": "源ノ角ゴシック Medium",
"#italic": false,
"#underLine": false,
"#strikeOut": false
},
"Open Sans": {
"replace": "Source Sans Variable Regular",
@KireinaHoro
KireinaHoro / playground.py
Created May 6, 2018 17:16
FrozenLake test tensorflow
import gym
import numpy as np
import tensorflow as tf
env = gym.make('FrozenLake-v0')
tf.reset_default_graph()
# establish the feed-forward part of the network used to choose actions
inputs1 = tf.placeholder(shape=[1, 16], dtype=tf.float32)
@KireinaHoro
KireinaHoro / config-4.9.95-gentoo
Created May 4, 2018 18:17
Kernel configuration for Gentoo in Hyper-V
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 4.9.95-gentoo Kernel Configuration
#
#
# Gentoo Linux
#
CONFIG_GENTOO_LINUX=y
CONFIG_GENTOO_LINUX_UDEV=y
@KireinaHoro
KireinaHoro / main.cpp
Created April 21, 2018 14:34
WarCraft assignment final version
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <vector>
// useless headers
#include <cstring>
#define SIDE(x) ((x)->getTerritory() ? "red" : "blue")
#include <algorithm>
#include <deque>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <unordered_map>
#include <vector>
// useless headers
#include <cstring>
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;