Skip to content

Instantly share code, notes, and snippets.

View xhacker's full-sized avatar
🌀

柳东原 · Dongyuan Liu xhacker

🌀
View GitHub Profile
@xhacker
xhacker / zjuwlan-crack.py
Last active December 21, 2015 20:29
ZJUWLAN Password
import requests
url = "https://net.zju.edu.cn/cgi-bin/srun_portal"
number_range = (0, 0)
if __name__ == "__main__":
for username in xrange(number_range[0], number_range[1]):
passwords = [username, "123456", "12345678"]
for password in passwords:
@xhacker
xhacker / build-and-run-cpp-st3.md
Last active October 8, 2020 10:52
Build and run C++ file in Sublime Text 3

How to Install

  • Tools → Build System → New build system...
  • Paste the content below
{
    "cmd": ["g++ ${file} -o ${file_path}/${file_base_name} && echo 'Build Finished' && ${file_path}/${file_base_name}"],
    "shell" : true
}
  • Save as C++ Build and Run.sublime-build
if [ "${CONFIGURATION}" = "Release" ]; then
path="$(pwd)/${INFOPLIST_FILE}"
build=$(defaults read $path CFBundleVersion)
defaults write $path CFBundleVersion $((build+1))
fi
@xhacker
xhacker / Preferences.sublime-settings
Created September 9, 2014 06:32
Sublime Settings
{
"color_scheme": "Packages/Dayle Rees Color Schemes/sublime/peacock.tmTheme",
"detect_indentation": true,
"dictionary": "Packages/Language - English/en_US.dic",
"ensure_newline_at_eof_on_save": true,
"font_face": "Menlo",
"font_size": 16,
"highlight_line": true,
"ignored_packages":
[
@xhacker
xhacker / .gitconfig
Last active August 29, 2015 14:06
.gitconfig
[user]
name = Xhacker Liu
email = [email protected]
[core]
editor = nano
excludesfile = /Users/xhacker/.gitignore_global
quotepath = false
pager = less -x4
[credential]
helper = osxkeychain
@xhacker
xhacker / Linux.sublime-keymap
Last active August 29, 2015 14:06
Mac-like Sublime Text keymap for Linux
[
{ "keys": ["ctrl+v"], "command": "paste_and_indent" },
{ "keys": ["ctrl+shift+v"], "command": "paste" },
{ "keys": ["ctrl+a"], "command": "move_to", "args": {"to": "bol", "extend": false} },
{ "keys": ["ctrl+e"], "command": "move_to", "args": {"to": "eol", "extend": false} },
{ "keys": ["ctrl+d"], "command": "right_delete" },
{ "keys": ["ctrl+k"], "command": "run_macro_file", "args": {"file": "res://Packages/Default/Delete to Hard EOL.sublime-macro"} },
{ "keys": ["ctrl+shift+a"], "command": "select_all" }
]
@xhacker
xhacker / .zshrc
Last active August 29, 2015 14:08
Aliases
alias cp="rsync -avrP --progress"
alias aria2c="aria2c -s 16 -x 16 -k 1M"
alias nl="sudo lsof -i | grep -i listen"
@xhacker
xhacker / git_history_cloner.py
Created November 7, 2014 21:09
Clone only the history of a repo into a new repo
import pygit2
from pygit2 import GIT_SORT_TOPOLOGICAL, GIT_SORT_REVERSE
repo = pygit2.Repository("/path/to/the/repo")
hist_repo = pygit2.Repository("/path/to/the/repo/for/the/history")
parents = []
for commit in repo.walk(repo.head.target,
GIT_SORT_TOPOLOGICAL | GIT_SORT_REVERSE):
print "[Duplicating] " + commit.message,
from timeit import timeit
setup = """
results = [0 for _ in xrange(100)]
results[1] = 1
results[2] = 1
def fib(n):
if results[n]:
return results[n]
@xhacker
xhacker / emoji.plist
Last active October 26, 2023 15:59
/System/Library/LinguisticData/RequiredAssets_zh.bundle/AssetData/emoji.plist in OS X 10.11 Copyright (C) Apple Inc.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>0</key>
<dict>
<key>emoji</key>
<array>
<string>0⃣️</string>
</array>