Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
query = r'"najib" OR "mahathir"' | |
def query_to_mysql(query, column_name): | |
query = query.replace(r'"', "'") | |
splitted = query.split("'") | |
for i in range(len(splitted)): | |
if splitted[i].find('AND') < 0 and splitted[i].find('OR') < 0 and len(splitted[i])>2: | |
splitted[i] = column_name + ' like \'%'+splitted[i]+'%\'' | |
return ' '+''.join(splitted) | |
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
string = '2015年5月17日' | |
import re | |
re.findall("[-+]?[.]?[\d]+(?:,\d\d\d)*[\.]?\d*(?:[eE][-+]?\d+)?", string) | |
# ['2015', '5', '17'] |
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 tensorflow as tf | |
x = tf.random_normal((32, 4, 10)) | |
out = tf.layers.dropout(x, 0.5, noise_shape=[x.shape[0], x.shape[1], tf.constant(1)])) |
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 tensorflow as tf | |
x = tf.random_normal((32, 4, 10)) | |
x_copy = x | |
size = 16 | |
kernel = 4 | |
rate = 2 | |
pad_len = (kernel - 1) * rate | |
x = tf.pad(x, [[0, 0], [pad_len, 0], [0, 0]]) | |
x = tf.layers.conv1d(x, size, 4, dilation_rate=rate) |