Skip to content

Instantly share code, notes, and snippets.

View Determinant's full-sized avatar
🛩️
Focusing

Ted Yin Determinant

🛩️
Focusing
View GitHub Profile
@Determinant
Determinant / p-dump.patch
Last active January 20, 2021 00:16
p-dump.patch
diff --git a/vms/platformvm/reward_validator_tx.go b/vms/platformvm/reward_validator_tx.go
index 58e2426c..ae21d7f0 100644
--- a/vms/platformvm/reward_validator_tx.go
+++ b/vms/platformvm/reward_validator_tx.go
@@ -14,6 +14,7 @@ import (
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/vms/components/avax"
"github.com/ava-labs/avalanchego/vms/components/verify"
+ "github.com/ava-labs/avalanchego/vms/secp256k1fx"
#include <cstdio>
#include <thread>
#include <vector>
#include <mutex>
#include <atomic>
#include <condition_variable>
#include <unistd.h>
std::atomic<bool> processing;
@Determinant
Determinant / gist:dd0f26436c8ef8c530e5d64937752753
Last active September 26, 2017 18:50 — forked from dvliman/gist:267b66ac3a321172fd35
linux-kernel-booting-process

GNU/Linux kernel internals

Linux kernel booting process. Part 1.

If you read my previous blog posts, you can note that sometime ago I have started to get involved low-level programming. I wrote some posts about x86_64 assembly programming for Linux. In the same time I started to dive into GNU/Linux kernel source code. It is very interesting for me to understand how low-level things works, how programs runs on my computer, how they located in memory, how kernel manages processes and memory, how network stack works on low-level and many many other things. I decided to write yet another series of posts about GNU/Linux kernel for x86_64.

Note, that I'm not professional kernel hacker and I don't write code for kernel at work, just a hobby. I just like low-level stuff and it is interesting to me how these

@Determinant
Determinant / xim_example.c
Last active October 9, 2023 13:54
A minimal example for X Input Method.
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#include <assert.h>
Display *dpy;
Window win;
extern crate winit;
extern crate libc;
extern crate x11_dl;
fn main() {
let mut events_loop = winit::EventsLoop::new();
unsafe {
libc::setlocale(libc::LC_CTYPE, b"zh_CN.utf8\0".as_ptr() as *const _);
let xlib = x11_dl::xlib::Xlib::open().expect("get xlib");
(xlib.XSetLocaleModifiers)(b"@im=fcitx\0".as_ptr() as *const _);
imap <C-h> deleteChar
imap <C-w> deleteWord
unmap x
map d closeTab
map u lastClosedTab
map <C-u> scrollPageUp
map <C-d> scrollPageDown
map <C-p> J
map <C-n> K
set smoothscroll
@Determinant
Determinant / append-ivectors.cc
Created August 17, 2015 12:36
Concatenate features with speaker level ivector
#include "base/kaldi-common.h"
#include "util/table-types.h"
#include "util/parse-options.h"
#include <map>
using namespace kaldi;
const char *usage =
"Concatenate features with speaker level ivector (e.g. appending speaker\n"
"ivector to each frame of the corresponding utterance)\n"
"Usage: append-ivectors <ivector-rspecifier> <utt2spk-rspecifier> <in-rspecifier2> <out-wspecifier>\n\n"
/*
* Author: Ted Yin (Maofan Yin) <ted.sybil@gmail.com>
* Description: Implementation for performing a move in direction left in 2048 game
*/
class Game2048 {
public int moveLeft(int[][] b, int i) {
int bonus = 0;
int h = 0; /* b[i][0..h-1] has its final value and cannot be changed
again (exactly the same definition in your hint) */
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@Determinant
Determinant / log.rst
Created July 20, 2014 16:29
Log of My Academic Life

Log of My Academic Life

Sun Jul 20

  • kaldi
    • 完成kaldi动态链接
    • 几经周折后,在小集群上重现