Skip to content

Instantly share code, notes, and snippets.

View dangkhoasdc's full-sized avatar

Le Tan Dang Khoa dangkhoasdc

View GitHub Profile
@dangkhoasdc
dangkhoasdc / .vimrc
Created March 28, 2013 16:28
My favorite config's vim
" vim: fdm=marker:
" Recommended for vim >= 7; no guarantee of compatibility with earlier versions
" Lucas Oman <[email protected]>
" --enable-rubyinterp --prefix=/usr --enable-ruby
" Get latest from: http://github.com/lucasoman/Conf/raw/master/.vimrc
" load pathogen
call pathogen#runtime_append_all_bundles()
filetype off
syntax on
#define MAX_BUFERROR 255
#define COMMAND_ERROR printf
#define NEWEXCEPTION(mess, code) { \
char err[MAX_BUFERROR]; \
sprintf(err,mess". CODE: %d.\n", code);\
COMMAND_ERROR (err);\
fflush(NULL);\
}
@dangkhoasdc
dangkhoasdc / translate_modified.cc
Created May 3, 2013 16:23
Phương thức được thêm vào trong lớp Machine của đồ án Nachos. Công dụng: Chuyển đổi vùng nhớ từ User mode sang kernel mode và ngược lại.
char* Machine::User2System(int virtAddr, int limit)
{
int i;
int ch;
char* kernelBuf = NULL;
kernelBuf = new char[limit+1];
if (kernelBuf == NULL)
{
return kernelBuf;
}
@dangkhoasdc
dangkhoasdc / template_header.h
Created June 19, 2013 13:59
Template header file. The order is just my experience. It is useful for small and medium projects.
/* * * * * * * * * * * * * * * * * * * *
* System and Standard Library header file
* Author: DangKhoaSDC.
* * * * * * * * * * * * * * * * * * * * /
#ifndef _STANDARDLIBS
#define _STANDARDLIBS
#ifndef __cplusplus
#error "Must use C++ compiler!!"
@dangkhoasdc
dangkhoasdc / archlinux_install.sh
Last active March 18, 2021 09:20
Things to do after install Arch Linux
#!/usr/bin/env bash
# Things to do after install ArchLinux (2012.12.01)
pacman --noconfirm -S sudo
# Enabled archlinuxfr repo
arch=$(uname -m)
sudo cp /etc/pacman.conf /etc/pacman.conf.bak
echo "" >> /etc/pacman.conf
echo "[archlinuxfr]" >> /etc/pacman.conf
@dangkhoasdc
dangkhoasdc / SIFT_OpenCV.cpp
Created November 12, 2013 07:18
SIFT features is implemented by OpenCV lib.
#include <stdio.h>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/nonfree.hpp"
using namespace cv;
static void help()
{
@dangkhoasdc
dangkhoasdc / 0_reuse_code.js
Created November 29, 2013 00:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
jQuery('.question-rankings').each(function(){ var choices = $(this).find('input');
var index = Math.floor(Math.random() * 3 + 1) + 1;
choices.get(index).checked = true;
});
jQuery('.question-answers').each(function(){
var choices = $(this).find('input');
var index = Math.floor(Math.random() * 2 + 2);
choices.get(index).checked = true;
});