Skip to content

Instantly share code, notes, and snippets.

View yxjxx's full-sized avatar
🎯
Focusing

Jing Yang yxjxx

🎯
Focusing
View GitHub Profile
@yxjxx
yxjxx / hyper.json
Last active November 24, 2022 05:30
~/.config/karabiner/
{
"description": "Change right_command to command+control+option+shift.",
"from": {
"key_code": "right_command",
"modifiers": {
"optional": [
"any"
]
}
},
@yxjxx
yxjxx / ss_status.1m.py
Last active May 6, 2017 13:38
bitbar plugin: shadowsocksX status
#!/Users/yxj/env/bin/python
# -*- coding: utf-8 -*-
# @Author: yxjxx
# @Date: 2016-01-09 13:28:49
# @Last Modified by: yxjxx
# @Last Modified time: 2016-01-09 19:04:17
from biplist import *
from os.path import expanduser
import json
@yxjxx
yxjxx / impbcopy.m
Created April 28, 2017 18:58 — forked from mwender/impbcopy.m
Command line copy an image file to the clipboard in Mac OS X. See first comment for install instructions.
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import <unistd.h>
BOOL copy_to_clipboard(NSString *path)
{
// http://stackoverflow.com/questions/2681630/how-to-read-png-image-to-nsimage
NSImage * image;
if([path isEqualToString:@"-"])
{
// http://caiustheory.com/read-standard-input-using-objective-c
@yxjxx
yxjxx / you-get.scpt
Created August 25, 2016 10:41
打开 iTerm 使用 you-get 下载 Chrome 当前 tab 页的视频
on alfred_script(q)
-- your script here
tell application "Google Chrome"
-- 获取当前标签页的标题
set tabname to get title of active tab of window 1
-- 获取当前标签页的超链接地址
set taburl to get URL of active tab of window 1
tell application "iTerm"
activate
set the clipboard to "cd /Users/yxj/env3;source bin/activate;you-get " & taburl & ""
@yxjxx
yxjxx / alfred-pinyin.py
Created January 6, 2016 00:53 — 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
@yxjxx
yxjxx / surge.conf
Created October 5, 2015 02:12 — forked from netputer/surge-multi-proxy.url
Surge config for SSLedge (Sample)
[Proxy]
# 为了方便将来修改,将可用服务器写成 Proxy 形式
US = protocol, us.server.com, port1, username, password
JP = protocol, jp.server.com, port2, username, password
# 要用美服,就把美服那行复制到下面,然后改叫 SSLEDGE
SSLEDGE = protocol, us.server.com, port1, username, password
# 要换日服,就把日服那行复制到下面,然后改叫 SSLEDGE
# 同名 Proxy,Surge 只保留最后一个
@yxjxx
yxjxx / 0_reuse_code.js
Created September 29, 2015 02:16
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
@yxjxx
yxjxx / cvimrc
Last active January 21, 2016 14:12
cvim config
let completionengines = ['google', 'google-image', 'youtube']
map <C-7> lastUsedTab
let blacklists = ["http://douban.fm/*","http://qex.github.io/*","http://qianshan.co/*","https://cloud.digitalocean.com/*","http://dazi.kukuw.com/*","https://courses.edx.org/*","http://www.liaoxuefeng.com/*"]
set nochangelog
map ; :
map : ;
"let configpath = '/Users/yxj/Dropbox/dotfiles/.cvimrc'
@yxjxx
yxjxx / encrypt.m
Last active August 29, 2015 14:21
- (NSDictionary *)encrypt:(NSData *)fileData forSuffixFile:(NSString *)fileSuffix{
NSMutableData *afterFile = [[NSMutableData alloc] init];
[afterFile appendData:fileData];
NSMutableData *keyContainer = [[NSMutableData alloc] init];
int PERCENTAGE = 1;
int ex_location = 0;
int ex_length = 0;
@yxjxx
yxjxx / file.m
Last active August 29, 2015 14:21
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
NSLog(@"bundlePath is %@",bundlePath);
NSString *documentDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentationDirectory, NSUserDomainMask, YES) lastObject];
NSLog(@"documentDirectory is %@", documentDirectory);
NSString *libraryDirectory = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) lastObject];
NSLog(@"libraryDirectory is %@", libraryDirectory);
NSString *cacheDirectory = [NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES) lastObject];