Skip to content

Instantly share code, notes, and snippets.

@michaelHL
michaelHL / linux_time_c.md
Last active July 3, 2017 17:29
Linux系统常用时间函数

Linux下常用的几个时间函数: time, gettimeofday, clock_gettime, _ftime

  • time提供了秒级的精确度

    • 头文件time.h
    • 函数原型
    time_t time(time_t * timer)
    
@michaelHL
michaelHL / word2pdf.vba
Last active April 27, 2023 03:05
vba - 批量word转pdf
Sub ConvertWordsToPdfs()
Dim directory As String
directory = "PATH\TO\DESIRED\DIR" ' The starting directory
Dim fso, newFile, folder, files
Set fso = CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder(directory)
Set files = folder.files
@michaelHL
michaelHL / .vimrc
Last active August 2, 2017 04:11
Vim Configuration
set nocompatible " be iMproved, required
filetype off " required
syntax on
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
" let path = '~/some/path/here'
" call vundle#rc(path)
@michaelHL
michaelHL / 2017-06-26_linux.md
Last active June 28, 2017 13:34
2017年6月折腾笔记

history 命令

  1. 可控浏览: history | less
  2. 利用环境变量 HISTTIMEFORMAT 在历史中显示 TIMEPSTAMP(时间戳):
export HISTTIMEFORMAT='%F %T '
  1. 完全清除历史消息:
history -c && history -w
作者:王晗
链接:https://www.zhihu.com/question/41206352/answer/146930087
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[UTF-8,a4paper, 11pt]{article}
%%%%%% 导入包 %%%%%%
@michaelHL
michaelHL / translate_youdao.r
Last active July 26, 2023 11:50
有道翻译api(via R), youdao dict
## install.packages(c("RCurl", "rjson", "digest"))
library(RCurl)
library(rjson)
library(digest)
## 老版, 已无法get到新的key
user = "blog125"
key = "21376174"
采用 times new roman字体应使用 usepackage{txfonts} 宏包。
采用粗体字应使用 usepackage{bm} 宏包。
\bf 转变为罗马族,直立形状,黑体系列的字体属性。
\it 转变为罗马族,斜体形状,中等粗细系列的字体属性。
\rm 转变为罗马族,直立形状,中等粗细系列的字体属性,这是默认的字体。
\sc 转变为罗马族,小型大写形状,中等粗细系列的字体属性。
\sf 转变为无衬线族,直立形状,中等粗细系列的字体属性。
\sl 转变为罗马族,slanted的斜体形状,中等粗细系列的字体属性。
\tt 转变为打字机族,直立形状,中等粗细系列的字体属性。
@michaelHL
michaelHL / c_dyn_arr.md
Last active July 5, 2017 05:26
C/C++动态分配数组

C语言中动态分配数组

原帖: http://blog.chinaunix.net/uid-11085590-id-2914577.html

如何动态的定义及使用数组呢? 记得一般用数组的时候都是先指定大小的。 当时问老师,老师说是不可以的。 后来又问了一位教C++的老师,他告诉我在C++里用new可以做到, 一直不用C++,所以也不明白。 今天在逛论坛时终于找到了C语言中的用法(看原贴):

@michaelHL
michaelHL / vscode_c.md
Last active August 2, 2017 09:45
利用VSCode搭建简易C&C++编译环境

利用VSCode搭建简易C&C++编译环境

1. MinGW GCC工具链

  • (可参考之前的gist: eclipse配置C/C++编译环境)
  • 老版本MinGW仅有32位的Tool Chain, 若需要编译64位程序, 转至MinGW-w64项目(推荐)
  • MinGW GCC 5.4.0 x86为例, 依次在Files界面选择Toolchains targetting Win32, Personal Builds, mingw-builds, 5.4.0, threads-posix, dwarf, i686-5.4.0-release-posix-dwarf-...进行下载.