This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func keyCodeToString(keyCode: CGKeyCode) -> String { | |
let curKeyboard = TISCopyCurrentKeyboardInputSource().takeRetainedValue() | |
let ptr = TISGetInputSourceProperty(curKeyboard, kTISPropertyUnicodeKeyLayoutData) | |
let keyboardLayoutPtr = UnsafePointer<UCKeyboardLayout>(ptr) | |
var deadKeyState: UInt32 = 0 | |
var actualStringLength = 0 | |
var unicodeString = [UniChar](count: 255, repeatedValue: 0) | |
let status = UCKeyTranslate(keyboardLayoutPtr, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
strCmd = "%COMSPEC% /c ping 192.0.2.1 -n 1 -w 1000 >nul" | |
Set shell = CreateObject("WScript.Shell") | |
shell.Run strCmd, 0, 1 | |
WScript.Echo("Foreground window title: " & vbCrLf & GetForeWindowCaption()) | |
Function GetForeWindowCaption() | |
Const WM_GETTEXT = &HD | |
Set DX = CreateObject("DynamicWrapperX") | |
DX.Register "user32", "GetForegroundWindow", "f=s", "r=l" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################################################################### | |
# Change the number of rows and columns to display in Launchpad # | |
# by typing the following two lines in Terminal. You can use any # | |
# two integers for the number of rows and columns. I'm using 15x10 # | |
#################################################################### | |
defaults write com.apple.dock springboard-columns -int 15 | |
defaults write com.apple.dock springboard-rows -int 10 | |
#################################################################### | |
# Reset all settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://community.topcoder.com/stat?c=problem_statement&pm=2402&rd=5009 | |
# | |
# 状态转移方程: | |
# | |
# max{ | |
# max{m[i-1][0], m[i-2][0] + A[i-1]}, | |
# max{m[i-1][1], m[i-2][1] + A[i]} | |
# } | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* 八皇后问题是一个非常有趣的问题,是由德国大数学家高斯首先提出来的。 | |
* 要求在国际象棋的棋盘上放置八个皇后,使她们不能互相攻击。 | |
* 即任何两个皇后不能处在同一行、同一列、同一条斜线上。 | |
* | |
* 问有多少种不同的摆法?并找出所有的摆法。 | |
* | |
* 问题分析: | |
* (1) 满足上述条件的八个皇后,必然是每行一个,每列一个。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![allow(dead_code)] | |
#[derive(Clone, Debug, PartialEq, Eq)] | |
struct Element { | |
name: String, | |
attributes: Vec<(String, String)>, | |
children: Vec<Element>, | |
} | |
/// Time For A Trait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import random | |
import signal | |
import sys | |
"""帮助 | |
输入 ? 显示正确答案 | |
""" | |
TEST_COUNT = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let blacklists = ["https://mail.google.com/* gi gt x r f"] | |
map H scrollLeft | |
map L scrollRight | |
map h previousTab | |
map l nextTab | |
map r reloadTabUncached | |
map u lastClosedTab | |
map R :restore<Space> | |
map , goBack |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "Map Left-Control+Open-Bracket to Escape", | |
"rules": [ | |
{ | |
"manipulators": [ | |
{ | |
"description": "Bracket Rule [left_control + open_bracket]", | |
"type": "basic", | |
"from": { | |
"key_code": "open_bracket", |
NewerOlder