Skip to content

Instantly share code, notes, and snippets.

@beta
beta / 7file.sh
Last active August 29, 2015 14:10
7file - a simple file manager in (BSD) bash
#!/bin/bash
# 输出分隔符
function separator () {
echo '-------------------------------------------------------------------------------'
}
# 输出当前目录中的文件列表
function show_files () {
count=0
@beta
beta / main.c
Created April 2, 2015 07:04
My operating system lesson homework - a simple Unix shell with history feature
//
// main.c
// Shell
//
// Created by Bitex Kuang on 4/2/15.
// Copyright (c) 2015 Bitex. All rights reserved.
//
#include <stdio.h>
#include <unistd.h>
@beta
beta / client.py
Created April 12, 2015 05:56
Homework of my Python lesson, a half-duplex server-client chatting program
#!/usr/bin/env python
import socket
import time
BUFFSIZE = 1024
NS_HOST = 'localhost'
NS_PORT = 53333
@beta
beta / private.xml
Last active February 25, 2020 02:55
My Karabiner private configurations for ikbc Poker II.
<?xml version="1.0"?>
<root>
<item>
<name>Directions</name>
<identifier>private.directions</identifier>
<autogen>
__KeyToKey__
KeyCode::I, ModifierFlag::CONTROL_L | ModifierFlag::COMMAND_L,
KeyCode::CURSOR_UP
</autogen>
@beta
beta / Lexer.java
Created November 14, 2015 12:52
A simple lexer for C programs.
package lexer;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
public class Lexer {
@beta
beta / SyntaxAnalyzer.java
Created December 2, 2015 12:20
SyntaxAnalyzer
package me.kyouko.syntaxanalyzer;
import java.util.ArrayList;
import java.util.List;
public class SyntaxAnalyzer {
String input;
List<Token> tokens;
@beta
beta / MainActivity.java
Last active August 2, 2016 06:51
Switching fragments
// Blablabla
/**
* Loads and switches to a new fragment.
* If a fragment with {@code tag} has already been loaded and was detached from the container,
* this method will detach the current fragment and reattach the fragment back again, instead
* of creating a new instance of the target fragment.
*
* @param cls {@code Class} of the new fragment
* @param tag a tag to identify a fragment
@beta
beta / Android.mk
Last active March 13, 2016 05:16
Codes for blog "Using Native OpenCV Code in Android Projects"
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
OPENCV_INSTALL_MODULES:=on
OPENCV_CAMERA_MODULES:=on
OPENCV_LIB_TYPE := STATIC
include $(LOCAL_PATH)/OpenCV.mk
@beta
beta / CvUtil.java
Last active March 13, 2016 07:37
Codes for blog "Using Native OpenCV Code in Android Projects"
package com.example.yourapp;
import android.util.Log;
import org.opencv.android.OpenCVLoader;
import org.opencv.core.Mat;
import java.util.ArrayList;
public class CvUtil {
@beta
beta / com_example_yourapp_CvUtil.h
Last active March 13, 2016 06:43
Codes for blog "Using Native OpenCV Code in Android Projects"
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_example_yourapp_CvUtil */
#ifndef _Included_com_example_yourapp_CvUtil
#define _Included_com_example_yourapp_CvUtil
#ifdef __cplusplus
extern "C" {
#endif
/*