This file contains hidden or 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 numpy as np | |
import tensorflow as tf | |
__author__ = "Sangwoong Yoon" | |
def np_to_tfrecords(X, Y, file_path_prefix, verbose=True): | |
""" | |
Converts a Numpy array (or two Numpy arrays) into a tfrecord file. | |
For supervised learning, feed training inputs to X and training labels to Y. | |
For unsupervised learning, only feed training inputs to X, and feed None to Y. |
This file contains hidden or 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
if [ -x /usr/games/fortune -a -x /usr/games/cowsay ]; then | |
fortune -a | cowsay -f $(ls /usr/share/cowsay/cows/ | shuf -n1) | |
fi |
This file contains hidden or 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
"""https://stackoverflow.com/a/43703735/4803860""" | |
import tensorflow as tf | |
with tf.device('/gpu:0'): | |
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') | |
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b') | |
c = tf.matmul(a, b) | |
with tf.Session() as sess: | |
print (sess.run(c)) |
This file contains hidden or 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
// ==UserScript== | |
// @name Disable comments | |
// @description Make reddit comments invisible. | |
// @version 0.1 | |
// @author You | |
// @grant GM_addStyle | |
// @match https://*.reddit.com/* | |
// @match https://*.youtube.com/* | |
// @match https://www.lefigaro.fr/* | |
// @match https://www.linkedin.com/* |
This file contains hidden or 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
// ==UserScript== | |
// @name Ads visibility on startpage | |
// @description Background-color is added to ads on the startpage site so they are made more visible. | |
// @version 0.1 | |
// @author You | |
// @match https://www.startpage.com/* | |
// @grant GM_addStyle | |
// ==/UserScript== | |
GM_addStyle("#adBlock > * { background-color: #e6e6ff; }"); |
This file contains hidden or 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
export TIME='TIME Command being timed: "%C" | |
TIME User time (seconds): %U | |
TIME System time (seconds): %S | |
TIME Elapsed (wall clock) time : %e | |
TIME Percent of CPU this job got: %P | |
TIME Average shared text size (kbytes): %X | |
TIME Average unshared data size (kbytes): %D | |
TIME Average stack size (kbytes): %p | |
TIME Average total size (kbytes): %K | |
TIME Maximum resident set size (kbytes): %M |
This file contains hidden or 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 random | |
from shapely.geometry import Point | |
def generate_random(number: int, polygon: gpd.GeoSeries): | |
""" | |
Select random point in polygon based on an inscribed circle of the polygon. | |
Parameters | |
---------- |
OlderNewer