Skip to content

Instantly share code, notes, and snippets.

@Khande
Khande / 0_reuse_code.js
Created July 12, 2014 15:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
key.setGlobalKey(['C-x', '0'], function (ev, arg) {
SplitBrowser.activeBrowserCloseWindow();
}, '現在のフレームを閉じる');
key.setGlobalKey(['C-x', '1'], function (ev, arg) {
var url = SplitBrowser.activeBrowser != gBrowser ? SplitBrowser.activeSubBrowser.src : null;
var browsers = SplitBrowser.browsers;
for (var i = 0; i < browsers.length; ++i)
browsers[i].close();
@Khande
Khande / alfred-pinyin.py
Created September 19, 2016 03:15 — forked from tiann/alfred-pinyin.py
make alfred support pinyin search
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# @author weishu @2015/12/7
import subprocess
import os
import re
import json
@Khande
Khande / auto_switch_kb.py
Created October 4, 2016 08:36 — forked from tiann/auto_switch_kb.py
auto switch keyboard to english in specific applications
#! /usr/bin/env python
# coding: utf-8
'''
auto switch keyboard between different applications
if you want to change the app list, modify the var 'ignore_list'
'''
from AppKit import NSWorkspace, NSWorkspaceDidActivateApplicationNotification, NSWorkspaceApplicationKey
@Khande
Khande / FloatLabelLayout.java
Created December 3, 2016 06:57 — forked from chrisbanes/FloatLabelLayout.java
FloatLabelLayout
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
#! /usr/bin/env python
# coding: utf-8
'''
auto switch keyboard between different applications
if you want to change the app list, modify the var 'ignore_list'
一定要用系统自带的 python, brew 或其他方式安装的 python 不能识别 AppKit 等模块花了很长时间在 pyobjc 的文档中看到这样一句话
The system version of Python (``/usr/bin/python``) includes a copy of
PyObjC starting at MacOSX 10.5 ("Leopard"). Installing other versions
@Khande
Khande / tmcleanup.md
Created April 5, 2023 01:10 — forked from linjer/tmcleanup.md
Script to automatically remote old Mac OSX Time Machine Backups older than a specified number of days

Prerequisites

  • gfind (via brew install findutils)
  • Time Machine drive mounted on your computer (or you can change path from standard /Volume/Time\ Machine\ Backups/Backups.backup.db/
  • Admin/sudo access in the OSX terminal

Script

  • Be sure to set the correct machine name. You can check the actual folder things are going into by looking in the backup location.
  • By default, it erases all backups older than 30 days. Adjust as desired.