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
import findspark | |
findspark.init() | |
import pyspark | |
import random | |
sc = pyspark.SparkContext(appName="") | |
sc.stop() | |
# get shape | |
print ((df.count(), len(df.columns))) |
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
import pandas as pd | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
import seaborn as sns |
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
import threading | |
from queue import Queue | |
q = Queue() | |
NUM_WORKER_THREADS = 150 | |
def parallel_work(q, produce, work, num_worker_threads): | |
producer = threading.Thread(target=produce) | |
producer.daemon = True |
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
function enable_vim() { document.querySelectorAll(".CodeMirror").forEach(function (e) { e.CodeMirror.setOption("vimMode", true); }); } | |
document.addEventListener('keydown', function(e) { | |
if (e.keyCode == 13 && e.metaKey || e.keyCode == 13 && e.shiftKey) { | |
for (var i = 0; i < 10; i++) setTimeout(enable_vim, 1000 * i); | |
} | |
}); | |
enable_vim(); |
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
# -*- coding: utf-8 -*- |
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
# 查放到.zshrc中 | |
redis-server | |
result=`ps aux | grep 6379 | grep redis-server` | |
if [[ "$result" == "" ]] | |
then | |
redis-server & | |
fi | |
tomcat-server | |
result1=`ps aux | grep tomcat | grep /Library/Java/JavaVirtualMachines` |
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
user_001,book_001,4 | |
user_001,book_002,3 | |
user_001,book_005,5 | |
user_002,book_001,5 | |
user_002,book_003,4 | |
user_002,book_005,4 | |
user_003,book_001,4 | |
user_003,book_003,5 | |
user_003,book_004,3 | |
user_003,book_005,4 |
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": "change application", | |
"rules": [ | |
{ | |
"description": "change application use poker", | |
"manipulators": [ | |
{ | |
"type": "basic", | |
"from": { | |
"key_code": "a", |
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
$.prototype.replaceChildText = function (text) { | |
let textNodes = this.contents().filter(function() { | |
return this.nodeType === 3; | |
}); | |
textNodes.each(function() { | |
if (this.nodeValue.trim() !== '') { | |
this.nodeValue = text | |
} | |
}); |
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
# -*- coding: utf-8 -*- | |
# 一个汉字算两个字符 | |
def _chars_fit_baohong_limit(element): | |
element_len = 0 | |
for index, char in enumerate(unicode(element)): | |
if element_len >= BAOHONG_TEXT_LENGTH_LIMIT: | |
index -= 2 | |
break | |
if u'\u4e00' <= char <= u'\u9fff': # 是汉字. | |
element_len += 2 |