Skip to content

Instantly share code, notes, and snippets.

@markwu
markwu / cfilter.vim
Created February 2, 2019 03:52 — forked from PeterRincker/cfilter.vim
Filter the quickfix list
" :Cfilter[!] /{pat}/
" :Cfilter[!] {pat}
" Filter the quickfix looking for pattern, `{pat}`. The pattern can match the filename or text.
" Providing `!` will invert the match (just like `grep -v`).
" Note: :cfilter command abbreviation is provided for convenience
"
" :Lfilter[!] /{pat}/
" :Lfilter[!] {pat}
" Same as :Cfilter but use the location list.
" Note: :lfilter command abbreviation is provided for convenience
@markwu
markwu / uninstall_vmware.sh
Created November 8, 2018 15:56
Completely uninstall VMWare on macOS
#!/usr/bin/env bash
# Usage: bash uninstall_vmware.bash
remove() {
entry="$1"
echo -ne "Removing $entry ["
sudo rm -rf "$entry"
if [[ ! -e "$entry" ]]; then
echo -ne "OK"
@markwu
markwu / ensure-cert-macos.sh
Created December 12, 2017 07:53 — forked from koop/ensure-cert-macos.sh
Ensures a certificate is in the macOS system keychain.
#!/bin/bash
# Usage
# $ ./install-cert-macos.sh "/path/to/cert"
CERT_PATH="$1"
# First, grab the SHA-1 from the provided SSL cert.
CERT_SHA1=$(openssl x509 -in "$CERT_PATH" -sha1 -noout -fingerprint | cut -d "=" -f2 | sed "s/://g")
# Next, grab the SHA-1s of any standard.dev certs in the keychain.
# Don't return an error code if nothing is found.
@markwu
markwu / dnsmasq OS X.md
Created December 10, 2017 10:17 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.dev domains, e.g. project.dev, awesome.dev and so on, without having to add to your hosts file each time.

Requirements

Install

@markwu
markwu / Mysqltop
Created March 21, 2017 07:06 — forked from cpliakas/Mysqltop
Mysql top
#!/bin/bash
watch -n 5 --differences mysqladmin processlist
@markwu
markwu / Mysqltop
Created March 21, 2017 07:06 — forked from cpliakas/Mysqltop
Mysql top
#!/bin/bash
watch -n 5 --differences mysqladmin processlist
@markwu
markwu / gist:73654de51e49c1eecc6f480b90ef935d
Created February 2, 2017 14:36
Uninstall XQuartz.app from OSX Yosemite/El Capitan/Sierra
launchctl unload /Library/LaunchAgents/org.macosforge.xquartz.startx.plist && \
sudo launchctl unload /Library/LaunchDaemons/org.macosforge.xquartz.privileged_startx.plist && \
sudo rm -rf /opt/X11* /Library/Launch*/org.macosforge.xquartz.* /Applications/Utilities/XQuartz.app /etc/*paths.d/*XQuartz && \
sudo pkgutil --forget org.macosforge.xquartz.pkg && \
rm -rf ~/.serverauth* && rm -rf ~/.Xauthorit* && rm -rf ~/.cache && rm -rf ~/.rnd && \
rm -rf ~/Library/Caches/org.macosforge.xquartz.X11 && rm -rf ~/Library/Logs/X11
@markwu
markwu / icon.sh
Created February 2, 2017 14:04 — forked from zqqf16/icon.sh
Create .icns & .iconset from .png
#!/bin/bash
# Usage: ./icon.sh icon.png
icon=$1
icon_name=${icon%.*}
icon_dir=${icon}.iconset
icon_tmp_path=/tmp/${icon_dir}
@markwu
markwu / appify.sh
Created February 2, 2017 06:59 — forked from oubiwann/appify.sh
appify — create the simplest possible Mac app from a shell script (adds an application icon)
#!/usr/bin/env bash
VERSION=4.0.1
SCRIPT=`basename "$0"`
APPNAME="My App"
APPICONS="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericApplicationIcon.icns"
OSX_VERSION=`sw_vers -productVersion`
PWD=`pwd`
function usage {
@markwu
markwu / tabcomplete.vim
Created January 7, 2017 16:26 — forked from lwakefield/tabcomplete.vim
tabcomplete
inoremap <expr> <tab> pumvisible() ? '<c-n>' : '<tab>'
inoremap <expr> <s-tab> pumvisible() ? '<c-p>' : '<tab>'
augroup autocomplete
autocmd!
autocmd TextChangedI * call TypeComplete()
augroup end
fun! TypeComplete()
if getline('.')[col('.') - 2] =~ '\K' && getline('.')[col('.') - 1] !~ '\K'
call feedkeys("\<c-n>")
end