Skip to content

Instantly share code, notes, and snippets.


Dangyi Liu liudangyi

View GitHub Profile
View .Xmodmap
! CapsLock to Control_L
clear lock
clear control
keycode 66 = Control_L
add control = Control_L Control_R
! left Alt & right Alt
keycode 64 = Meta_L
keycode 108 = Meta_R
liudangyi /
Created Apr 14, 2018
Fix FortiGate DDNS Update NOTZONE problem
#!/usr/bin/env python3
from __future__ import print_function
from netfilterqueue import NetfilterQueue
from scapy.layers.dns import *
def modify(pkt):
ip = IP(pkt.get_payload())
liudangyi / vimrc
Last active Mar 5, 2017
My vimrc file
View vimrc
set nocompatible
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'flazz/vim-colorschemes'
" Plugin 'jiangmiao/auto-pairs'
Plugin 'ctrlpvim/ctrlp.vim'
liudangyi / brew-launch
Last active Aug 29, 2015
Homebrew launchctl script
View brew-launch
#!/usr/bin/env ruby
DEFAULT = %w(mongodb memcached)
RUNNING = `launchctl list | grep homebrew.mxcl`{|s|s.sub!(/\Ahomebrew\.mxcl\./, "")}
BREW_PATH = `brew --prefix`.chomp
AVAILABLE ="#{BREW_PATH}/opt").select{|name|File.exists?("#{BREW_PATH}/opt/#{name}/homebrew.mxcl.#{name}.plist")}
def start(app)
if AVAILABLE.include? app
liudangyi /
Created Dec 18, 2012
Ignore SSL Errors with NPM Node Package Manager
npm config set strict-ssl false
liudangyi / gist:4324850
Created Dec 18, 2012
Get the IPv4 address of eth0 in shell
View gist:4324850
ifconfig eth0 | grep inet | grep -v inet6 | awk '{print $2}' | sed 's/.*://g'
liudangyi / TaskPaper2Evernote.applescript
Last active Dec 9, 2015
Create a new note using a text file (e.g. Todo.taskpaper under document folder) in Evernote, and sync with it every 20 min.
View TaskPaper2Evernote.applescript
-- e.g. replaceString("Hello hello", "hello", "Bye") --> "Hello Bye"
on replaceString(theText, oldString, newString)
-- ljr (
local ASTID, theText, oldString, newString, lst
set ASTID to AppleScript's text item delimiters
considering case
set AppleScript's text item delimiters to oldString
set lst to every text item of theText