Skip to content

Instantly share code, notes, and snippets.

Avatar

Linfeng Li llinfeng

  • The University of Michigan
  • Ann Arbor, MI, USA
View GitHub Profile
@llinfeng
llinfeng / profile.log
Created Sep 15, 2022
Profiling vimwiki link creation on a Linux machine
View profile.log
FUNCTION <SNR>167_update_hg_branch()
Defined: ~/vimfiles/plugged/vim-airline/autoload/airline/extensions/branch.vim:148
Called 23 times
Total time: 0.002346
Self time: 0.002071
count total (s) self (s)
23 0.000465 0.000190 if airline#util#has_lawrencium()
let cmd='LC_ALL=C hg qtop'
let stl=lawrencium#statusline()
@llinfeng
llinfeng / profile.log
Created Sep 15, 2022
Profiling Vimwiki Link Creation
View profile.log
SCRIPT /home/llinfeng/vimfiles/plugged/vimwiki/autoload/vimwiki/diary.vim
Sourced 1 time
Total time: 0.000560
Self time: 0.000560
count total (s) self (s)
" vim:tabstop=2:shiftwidth=2:expandtab:textwidth=99
" Vimwiki autoload plugin file
" Description: Handle diary notes
" Home: https://github.com/vimwiki/vimwiki/
@llinfeng
llinfeng / .OpenOneNoteLink_on_Android.md
Last active Jul 4, 2022
Use adb to launch a page in OneNote APK on an Android tablet
View .OpenOneNoteLink_on_Android.md
@llinfeng
llinfeng / eink_clean.ahk
Last active Jul 31, 2022
Force full-screen refresh on e-ink monitors
View eink_clean.ahk
#SingleInstance, force ; Allow only one instance of this script to be running.
#Persistent ; To stop the script from exiting.
; Here, press F1 to trigger the black/white flash
F1::
; Source: https://superuser.com/questions/662264/i-would-like-to-make-the-screen-go-black-every-8-seconds-how
Gui, Color, 000000
Gui, Show, x-5000 y-20 w8000 h8000
sleep 333
Gui, Color, FFFFFF
@llinfeng
llinfeng / Config_Zathura.txt
Last active May 19, 2022
Config VimTeX + Zathura with forward/backward search using NeoVim
View Config_Zathura.txt
# Store as `~/.config/zathura/zathurarc`
# Store the following in `~/.config/nvim/init.vim`.
# Though, with VimTeX, it is optional to populate the synctex setting in Zathura.
set synctex true
@llinfeng
llinfeng / Overleaf_V2_mappings.js
Last active Sep 10, 2021
Greasemonkey Script with Forward search in Overleaf
View Overleaf_V2_mappings.js
// ==UserScript==
// @name Overleaf Editor Custom VIM Keybindings
// @namespace http://tampermonkey.net/
// @version 0.1
// @match https://www.overleaf.com/project/*
// @grant none
// Source 1: https://groups.google.com/d/msg/ace-discuss/gwXMzUM17I4/9B_acHBSCQAJ
// Source 2: https://www.overleaf.com/learn/how-to/How_can_I_define_custom_Vim_macros_in_a_vimrc_file_on_Overleaf%3F
// ==/UserScript==
@llinfeng
llinfeng / xchange_viewer_underline_change.ahk
Last active Mar 2, 2020
Use right-click and then `f` to change underline style for XChange Viewer
View xchange_viewer_underline_change.ahk
#IfWinActive ahk_exe PDFXCview.exe
; Note, this script is built on one major assumption:
; 1. that there is a labeled routine called CenterMouseOnActiveWindow, from: https://www.autohotkey.com/boards/viewtopic.php?t=60433
; 2. that the Property window shall open at the **center** of the active window. For XChangeViewer, this is exactly the case.
~RButton::
Hotkey, f, f, On
KeyWait, f, D T3
Hotkey, f, f, Off
if(!ErrorLevel) {
; Send, {Esc}
@llinfeng
llinfeng / TP_middle_Scroll.ahk
Last active Jul 29, 2022
AHK - scroll with middle-mouse-key + trackpoint for Thinkpad keyboards
View TP_middle_Scroll.ahk
; Midbutton down for scrolling {{{
; Feature: with acceleration as intended.
; Source: http://forum.notebookreview.com/threads/ultranav-middle-click-button-scroll.423415/
; Linking source: https://superuser.com/questions/91074/thinkpad-trackpoint-scrolling-and-middle-click-possible
; Working version {{{
$*MButton::
Hotkey, $*MButton Up, MButtonup, off
KeyWait, MButton, T0.2
If ErrorLevel = 1
{
@llinfeng
llinfeng / cVimrc
Created Jan 6, 2020
cVim white list
View cVimrc
let blacklists = ["https://mail.google.com/*","http://localhost/*","https://calendar.google.com/*","https://www.overleaf.com/*","https://app.getpocket.com/*","https://gallery.mailchimp.com/*","https://colab.research.google.com/*","https://www.tumblr.com/*","https://www.youtube.com/*","https://docs.google.com/*","https://todoist.com/*","https://toggl.com/*","https://groups.google.com/*"]
" Settings
@llinfeng
llinfeng / AHK_Markdown_to_go.ahk
Created Dec 7, 2019
An Autohotkey snippet that converts raw Markdown texts into "pastable" rich-text, for Gmail and even MS Word.
View AHK_Markdown_to_go.ahk
::togo::
; Debugging tips
; 1. Check if pandoc is installed. If not, the best way is to install through choco.
; choco install page:https://chocolatey.org/packages/pandoc
; 2. Check if `paste.exe` is available to PowerShell, same thing for `clip.exe` ==> these two are necessary Windows utilities/executable that were called with Ctrl+V and Ctrl+C
Run, PowerShell "paste.exe | pandoc -f markdown-smart --from=gfm -t HTML | Set-Clipboard -AsHtml ; echo 'Conversion done.' "
; Caveat: single quotes are pasted wrongly, as question marks.
Return