Skip to content

Instantly share code, notes, and snippets.

@1yx
1yx / disable_cmd_w.json
Last active December 12, 2023 02:34 — forked from jimpsson/disable_cmd_tab_or_q.json
Redefine builtin MacOS default keyboard shortcuts with Karabiner-Elements to vk_none effectively making the keybinding disabled. In Karabiner-Elements vk_none means VirtualKeyboard None, use it when you want to disable any keybinding. This example disables Application Switcher (command+tab), and/or Application Quit keyboard shortcut (command+q).
{
"title": "Disable MacOS builtin default keybinding (cmd + w)",
"rules": [
{
"description": "Disable Application Window Close",
"manipulators": [
{
"type": "basic",
"from": {
"key_code": "w",
@1yx
1yx / readLocation.js
Last active September 26, 2023 01:32
read qq location list file in js, special thanks https://www.v2ex.com/t/32786
var parseString = require('xml2js').parseString;
var fs = require('fs');
var _ = require('underscore');
require.extensions['.xml'] = function (module, filename) {
module.exports = fs.readFileSync(filename, 'utf8');
};
var zh = require("./LocList-zh.xml");
var en = require("./LocList-en.xml");
@1yx
1yx / unix.ahk
Created August 8, 2018 05:52
An AutoHotKey script that provides UNIX & Linux keyboard shortcuts on Windows
;;
;; fork from https://github.com/usi3/emacs.ahk/blob/master/emacs.ahk
;;
;; An autohotkey script that provides emacs-like keybinding on Windows
;;
#InstallKeybdHook
#UseHook
; The following line is a contribution of NTEmacs wiki http://www49.atwiki.jp/ntemacs/pages/20.html
SetKeyDelay 0
@1yx
1yx / cloudSettings
Created April 17, 2020 15:56
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-04-17T15:56:56.983Z","extensionVersion":"v3.4.3"}
class Solution {
public int ladderLength(String beginWord, String endWord, List<String> wordList) {
Set<String> dict = new HashSet<>(wordList), temp = new HashSet<>();
Set<String> begin = new HashSet<>(), end = new HashSet<>();
if (!dict.contains(endWord)) return 0;
int step = 1;
begin.add(beginWord);
end.add(endWord);
dict.remove(beginWord);
while(!begin.isEmpty() && !end.isEmpty()) {
// 假设你正在爬楼梯。需要 n 阶你才能到达楼顶。
// 每次你可以爬 1 或 2 或 3 个台阶。你有多少种不同的方法可以爬到楼顶呢?
class Solution {
public int climbStairs(int n) {
int[] dp = new int[n + 1];
dp[1] = 1;
dp[2] = 2;
dp[3] = 4;
if (n < 4) return dp[n];
for (int i = 4; i <= n; i++) {
@1yx
1yx / cloudSettings
Last active March 11, 2020 07:03
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-03-11T06:52:03.269Z","extensionVersion":"v3.4.3"}
@1yx
1yx / .spacemacs
Last active August 23, 2018 09:54
my dot spacemacs
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory
;; `+distribution'. For now available distributions are `spacemacs-base'
@1yx
1yx / gist:9bd91b60006d5f0d9968
Last active April 4, 2018 04:48
squirrel color scheme with dracula-theme(github.com/zenorocha/dracula-theme).
We couldn’t find that file to show.
@1yx
1yx / ecosystem.config.js
Created February 21, 2017 14:46
pm2 cron restart demo
module.exports = {
apps : [
{
name: 'pm2cron',
script: 'index.js',
exec_mode: 'fork',
instance: 1,
cron_restart: '* * * * *'
}]
}