Skip to content

Instantly share code, notes, and snippets.

View cartmanie's full-sized avatar

Chao Jiang cartmanie

View GitHub Profile
@cartmanie
cartmanie / js snippet
Created January 15, 2020 09:27
enable selectable & right click in some pages
javascript:var allElements = document.getElementsByTagName('*');for (var i = 0, len = allElements.length; i < len; i++) {var element = allElements[i];if (window.getComputedStyle(element).getPropertyValue('user-select')==="none"){element.style.setProperty('user-select','auto');}};document.oncontextmenu= function(){return true;};document.body.onselectstart= function(){return true};
@cartmanie
cartmanie / js
Created January 14, 2020 08:53
javascript snippet to make life easier
javascript:document.body.contentEditable = !(document.body.contentEditable=='true'); document.designMode=!(document.designMode=='true');
javascript:var allElements = document.getElementsByTagName('*');for (var i = 0, len = allElements.length; i < len; i++) {var element = allElements[i];if (element.style.getPropertyValue('user-select') !=='unset'){element.style.setProperty('user-select','unset');}else {element.style.removeProperty('user-select')}};document.oncontextmenu= function(){return true;};document.body.onselectstart= function(){return true};
javascript:var allElements = document.getElementsByTagName('*');for (var i = 0, len = allElements.length; i < len; i++) {var element = allElements[i];if (element.style.getPropertyValue('user-select') !=='unset'){element.style.setProperty('user-select','unset');}else {element.removeAttribute('style');}};
document.oncontextmenu= function(){return true;};document.body.onselectstart= function(){return true};
@cartmanie
cartmanie / py
Created May 17, 2019 06:03
批量下载规则的url
for url in urls:
cmd_str="lftp_i {}"
cmd=str.format(cmd_str,url)
print(cmd)
cmd="source ~/.zshrc;"+cmd
print(cmd)
os.system(cmd)
@cartmanie
cartmanie / jinja2_file_less.py
Created December 5, 2016 04:19 — forked from wrunk/jinja2_file_less.py
python jinja2 examples
#!/usr/bin/env/python
#
# More of a reference of using jinaj2 without actual template files.
# This is great for a simple output transformation to standard out.
#
# Of course you will need to "sudo pip install jinja2" first!
#
# I like to refer to the following to remember how to use jinja2 :)
# http://jinja.pocoo.org/docs/templates/
#
@cartmanie
cartmanie / .sh
Created October 15, 2016 08:05
convert jpg to png
for i in *.jpg; do sips -s format png $i --out `basename $i .jpg`.png ;done
@cartmanie
cartmanie / git-proxy.txt
Created June 30, 2016 08:45 — forked from goncha/git-proxy.txt
Git and socks5 proxy
gang@debian:~$ sudo apt-get install netcat-openbsd
gang@debian:~$ cat /usr/local/bin/git-proxy-wrapper
#!/bin/bash
nc -xlocalhost:1080 -X5 $*
gang@debian:~$ export GIT_PROXY_COMMAND=/usr/local/bin/git-proxy-wrapper
@cartmanie
cartmanie / gist:e1fcdf5906aa4401bec42d8528945cb6
Created June 6, 2016 11:27
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (PC)

Loosely ordered with the commands I use most towards the top. Sublime also offer full documentation.

Editing

Ctrl+C copy current line (if no selection)
Ctrl+X cut current line (if no selection)
Ctrl+⇧+K delete line
Ctrl+↩ insert line after
@cartmanie
cartmanie / IdeaVim OS X Key Repeat.markdown
Created May 27, 2016 11:06 — forked from lsd/IdeaVim OS X Key Repeat.markdown
Enable key-repeat for ALL applications or just for IdeaVim/specific JetBrains apps

Upgrading to Lion or Yosemite and WebStorm 9, I noticed key repeat was
turned off for the IdeaVim plugin h j k l keys.

System-wide key repeat

defaults write -g ApplePressAndHoldEnabled -bool false in a terminal will enable
key repeat for every app. This can alternatively be found in the accessibility settings in OS X' preferences.

App specific key repeat

@cartmanie
cartmanie / keyrepeat.shell
Created May 27, 2016 10:25 — forked from kconragan/keyrepeat.shell
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@cartmanie
cartmanie / commit.sh
Last active August 29, 2015 14:02
a simple svn bash commit script
#!/bin/sh
COMMENT="提交一次"
CWD=/Users/jc/Documents
if [[ $# > 0 ]];then
COMMENT=$1;
fi