Skip to content

Instantly share code, notes, and snippets.


Ted Yin Determinant

View GitHub Profile
View competing_workers.cpp
#include <cstdio>
#include <thread>
#include <vector>
#include <mutex>
#include <atomic>
#include <condition_variable>
#include <unistd.h>
std::atomic<bool> processing;
View gist:dd0f26436c8ef8c530e5d64937752753

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 / xim_example.c
Last active Jan 4, 2020
A minimal example for X Input Method.
View xim_example.c
#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 _);
View cvimrc
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 /
Created Aug 17, 2015
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) <>
* 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) */
View config.json
"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 / log.rst
Created Jul 20, 2014
Log of My Academic Life
View log.rst

Log of My Academic Life

Sun Jul 20

  • kaldi
    • 完成kaldi动态链接
    • 几经周折后,在小集群上重现
Determinant / simple_spec.c
Last active Oct 28, 2019
Simple Spec -- A Simple Discrete-time STFT Program.
View simple_spec.c
#include <math.h>
#include <sndfile.h>
#include <string.h>
#include <assert.h>
#include <getopt.h>
#define PI 3.141592653589793
#define EPS 1e-8
#define MAX_BIN_NUM 65536
/* SHIFT_NUM should be less than or equal to BIN_NUM */
You can’t perform that action at this time.