Skip to content

Instantly share code, notes, and snippets.

View itomg's full-sized avatar

Jimmy Zhao itomg

View GitHub Profile
@itomg
itomg / README.md
Created January 24, 2017 01:42 — forked from zhiguangwang/README.md
Disable and Enable kdc on Mac OS X

If you don't like or need the kdc process on Mac OS X, which opens TCP port 88 to the world, you can disable it with launchctl.

Disable:

sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist

Enable:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.Kerberos.kdc.plist
@itomg
itomg / labels.sh
Last active October 27, 2015 09:10
Delete and create github repo issue labels
#!/bin/bash
echo -n "GitHub User: "
read USER
echo -n "GitHub Password: "
read -s PASS
echo ""
echo -n "GitHub Repo (e.g. foo/bar): "
@itomg
itomg / email-regex.txt
Last active February 8, 2024 16:21
Email Regex In Different Languages
## Ref http://emailregex.com/
#### General Email Regex (RFC 5322 Official Standard)
```
(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
```
#### Python
```python
r"(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)"
@itomg
itomg / iterm2-hidden-dock.sh
Created July 8, 2015 13:01
Hide Iterm2 in dock
## ref http://www.zhihu.com/question/27447370
## 隐藏iTerm Dock 图标
/usr/libexec/PlistBuddy -c "Add :LSUIElement bool true" /Applications/iTerm.app/Contents/Info.plist
## 如果要恢复 Dock 图标:
/usr/libexec/PlistBuddy -c "Delete :LSUIElement" /Applications/iTerm.app/Contents/Info.plist
@itomg
itomg / .slate.js
Created July 8, 2015 02:23
My slate config
var pushRight = slate.operation("push", {
"direction": "right",
"style": "bar-resize:screenSizeX/2"
});
var pushLeft = slate.operation("push", {
"direction": "left",
"style": "bar-resize:screenSizeX/2"
});
@itomg
itomg / redis-del-multiple.sh
Created June 17, 2015 04:26
Redis del mulitple keys
## run in terminal
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
## run in redis-cli
EVAL "return redis.call('del', unpack(redis.call('keys', ARGV[1])))" 0 prefix:*
@itomg
itomg / dig-dns-server.sh
Created June 5, 2015 01:08
How to find out your host's domain server
## find out root dns server domain
dig .
## find out com. server
dig @root-server com.
## find out your domain dns server
dig @com-dns-server your-host.com.
@itomg
itomg / Determine_tomcat_and_java_version.sh
Created June 4, 2015 08:24
How to Determine Your Version of Tomcat and Java
## Linux:
java -cp lib/catalina.jar org.apache.catalina.util.ServerInfo
## Windows:
java.exe -cp lib\catalina.jar org.apache.catalina.util.ServerInfo
@itomg
itomg / bind-ST-commands
Created March 4, 2015 02:45
How to find and bind commands in Sublime Text
1. control + ~: open log
sublime.log_comands(True);
2. select a file and right click "Reveal in Side Bar"
reveal_in_side_bar
3. bind command to "/Users/.../Library/Application Support/Sublime Text 3/Packages/User/Default (OSX).sublime-keymap"
{ "keys": ["command+shift+\\"], "command": "reveal_in_side_bar" }
4. close log
sublime.log_comands(False);
@itomg
itomg / solr-delete-by-query.sh
Created November 4, 2014 01:29
Delete docs from solr by query
http://10.0.3.100:8983/solr/customs-company/update/?stream.body=<delete><query>record_count:0</query></delete>&stream.contentType=text/xml;charset=utf-8&commit=true