Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
Roboting

Dangyi Liu liudangyi

🤖
Roboting
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
liudangyi / dns_forward.py
Created Apr 14, 2018
Fix FortiGate DDNS Update NOTZONE problem
View dns_forward.py
#!/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
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
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`.split.select{|s|s.sub!(/\Ahomebrew\.mxcl\./, "")}
BREW_PATH = `brew --prefix`.chomp
AVAILABLE = Dir.new("#{BREW_PATH}/opt").select{|name|File.exists?("#{BREW_PATH}/opt/#{name}/homebrew.mxcl.#{name}.plist")}
def start(app)
if AVAILABLE.include? app
@liudangyi
liudangyi / npm_ignore_ssl.sh
Created Dec 18, 2012
Ignore SSL Errors with NPM Node Package Manager
View npm_ignore_ssl.sh
npm config set strict-ssl false
@liudangyi
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
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 (http://applescript.bratis-lover.net/library/string/)
local ASTID, theText, oldString, newString, lst
set ASTID to AppleScript's text item delimiters
try
considering case
set AppleScript's text item delimiters to oldString
set lst to every text item of theText