Skip to content

Instantly share code, notes, and snippets.

View Vigilans's full-sized avatar
🎯
Focusing

Vigilans Vigilans

🎯
Focusing
  • Nanjing University
  • Nanjing, China
View GitHub Profile
@Vigilans
Vigilans / dkms.conf
Created July 25, 2023 02:37
Patches for building nvidia-legacy-390xx-kernel-dkms_390.157-1 with clang on linux 6.x kernel
# DKMS configuration for the NVIDIA kernel module. -*- sh -*-
# The version is replaced at build time by dh_dkms invoked in debian/rules.
PACKAGE_NAME="nvidia-legacy-390xx"
PACKAGE_VERSION="390.157"
# The NVIDIA driver does not support real-time kernels.
# Can't easily set this via BUILD_EXCLUSIVE.
[[ "$kernelver" =~ "-rt-" ]] && build_exclude="yes"
@Vigilans
Vigilans / toolchain.profile.sh
Created October 31, 2021 13:33
Profile script for setting up cross-compile environment when building softwares/modules for asuswrt-merlin firmware system.
# Use the profile's directory as the project root
export CROSS_COMPILE_PROJECT_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
export ASUSWRT_MODEL=${1:-rt-ax86u}
export ASUSWRT_BASE=/opt/asuswrt
export TOOLCHAIN_BASE=/opt/toolchains
case $ASUSWRT_MODEL in
rt-ac86u)
# Toolchain profiles
@Vigilans
Vigilans / !Genetic Alogrithm
Last active July 11, 2022 08:32
Genetic algorithm framework
High performance genetic algorithm framework, based on:
* Template duck typing to define a problem
* Thread pool for evaluating fitness
@Vigilans
Vigilans / ALocalDebuggerTemplate.cpp
Last active March 27, 2019 08:33
Local debugger template example (cpp)
#include "pre-solution.h"
#include "solution.h"
#include "post-solution.h"
#ifndef __SYSTEM_DESIGN
json __algorithm();
#define __run __algorithm
#else
/* /file EinsteinProblem.cpp
/description Implemented with DFS algorithm
*/
#include <vector>
#include <functional>
#include <algorithm>
#include <iostream>
using namespace std;
@Vigilans
Vigilans / A-labyrinth-game.m
Last active November 30, 2018 08:22
Matlab labyrinth game with BFS solution search
% 迷宫小游戏程序入口
% 起点在左上角,终点在右下角
% 游戏结束时,会显示最短路径
% 之后,会显示当前所走的步数、所用的时间及最短路径的步数
function labyrinth_game()
next_choice = true;
while next_choice == true;
[row, col] = prompt_difficulty_choice(); % 选择难度
next_choice = main_process(row,col); % 进入游戏主流程
end
@Vigilans
Vigilans / SimpleCaculatorKernel
Last active November 27, 2018 11:46
Simple cacluator kernel
计算机课设项目 -- 计算器
这个gist封装了简单、完整的计算器内核库,在其上进行简单包装即可得到GUI版计算器。
@Vigilans
Vigilans / AVLTree
Last active November 27, 2018 11:44
AVL Tree
数据结构第13周作业 - AVL树与查找
此份代码实现了以下功能:
1. 随机数发生器:
* 生成可重复/无重复的随机数
* 用随机数填充一个范围内的所有元素
2. AVL树。实现的操作有:
* 公有方法:
- 构造:支持范围构造、初始化列表构造,可自定义关键码比较函数
- 插入:insert()
- 搜索:find()
@Vigilans
Vigilans / generalized_list.hpp
Created November 27, 2018 08:43
template implementation of generalized list
#pragma once
#include <functional>
#include <initializer_list>
#include <memory>
#include <stack>
#include <string>
#include <cctype>
template <typename _Ty>
class GeneralizedList
@Vigilans
Vigilans / Academic-code-assigments
Last active November 27, 2018 08:40
大一~大二课程作业相关代码
这个gist收集了大一~大二的C++、数据结构与JAVA课上一部分个人认为有价值的代码。
一些完成度更高的作业(如AVL树)会单独做成一个gist。
每一份作业整合成单文件形式。
代码列表:
- TurtleDiagram.cpp: 乌龟图游戏
- PerfectNumber.(cpp|java|kt): O(nlogn)筛求n以内的所有完美数
- PascalTriangle.(java|kt): Java/Kotlin画杨辉三角
- Hanoi.cpp: 汉诺塔
- Rational_Polynomial.cpp: 有理数类与多项式类