Skip to content

Instantly share code, notes, and snippets.

View fannheyward's full-sized avatar
🎯
Slow to response

Heyward Fann fannheyward

🎯
Slow to response
View GitHub Profile
set nocompatible
set runtimepath^=~/.config/nvim/plugged/coc.nvim
filetype plugin indent on
syntax on
set hidden
set runtimepath^=~/src/coc-clangd
"Completion settings
"Use complete_info() if you need confirm completion only when there's selected complete item
@fannheyward
fannheyward / git paging.md
Created July 24, 2020 05:02 — forked from hutusi/git paging.md
Git checkout next / prev commit

Treat git log as a book, exec git next or git prev to checkout the next or the previous commit.

@fannheyward
fannheyward / Installation.md
Last active September 10, 2019 06:55 — forked from albertbori/Installation.md
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
#!/bin/sh
set -uex
DIR=XXX
cd ${DIR}
REV1=$(git rev-parse --verify HEAD)
git pull
REV2=$(git rev-parse --verify HEAD)
/* dark mode */
@media (prefers-color-scheme: dark) {
body {
background-color: black;
color: white;
}
}
@media (prefers-color-scheme: light) {
body {
background-color: white;
@fannheyward
fannheyward / install_caffe_macos.md
Created February 15, 2019 03:06
Install Caffe on macOS.

Install Caffe on macOS

install protobuf 3.5

wget https://github.com/protocolbuffers/protobuf/archive/v3.5.1.zip
unzip v3.5.1.zip
cd protobuf-3.5.1
./autogen.sh
./configure
@fannheyward
fannheyward / Makefile
Last active March 26, 2019 09:30
Makefile for go
ifndef VERBOSE
.SILENT:
endif
BINARY=$(shell basename $(CURDIR))
BINARY_LINUX=$(BINARY)_linux
export GO111MODULE=on
.PHONY : default
if !exists('g:neomake') | let g:neomake = {} | endif
let g:neomake_verbose = 1
"let neomake.open_list = 2 " also preserve cursor position
let g:neomake_list_height = 5
"let g:neomake_php_enabled_makers = ['php', 'phpcs', 'phpmd']
let g:neomake_latex_enabled_makers = ['chktex', 'lacheck', 'rubberinfo', 'proselint', 'latexrun']
let g:neomake_bib_enabled_makers = ['bibtex']
let g:neomake_nvimluatest_maker = {
\ 'exe': 'sh',
@fannheyward
fannheyward / ssdb.lua
Created July 21, 2017 09:05
wrapper of lua-resty-ssdb
#!/usr/bin/env lua
local SSDB = require 'resty.ssdb'
local _M = {
_VERSION = '0.0.1'
}
local mt = {
__index = _M
local function log_wrapper(...)
local pos_info = debug.getinfo(2)
ngx.log(ngx.ERR, pos_info.short_src, ":", pos_info.currentline,
": ", pos_info.name, ":", ...)
end