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 tensorflow as tf | |
def approach_1(): | |
def gen(): | |
l = ["foo", "bar", "baz"] | |
l1 = [f"{x}_py" for x in l] | |
l2 = [f"{x}_java" for x in l] | |
d1 = tf.data.Dataset.from_tensor_slices(l1) |
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 gin | |
import jax | |
import jax.numpy as jnp | |
import haiku as hk | |
@gin.configurable | |
class Model(hk.Module): | |
def __init__(self, num_classes, name=None): | |
super().__init__(name=name) |
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 mmap | |
from cffi import FFI | |
""" | |
add.c | |
double add(double a, double b) { | |
return a+b | |
} | |
~$ gcc -O3 -c add.c | |
~$ objdump -d add.o |
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 math | |
import numpy as np | |
def original_mirror(x, direction=0, reverse=False): | |
"""Mirrors left to right or top to bottom as per the direction.""" | |
x_ = np.copy(x) | |
height, width = x.shape | |
if direction == 0: | |
half_break = math.ceil(height/2) | |
shift = height % 2 |
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 t5 | |
import tensorflow.compat.v1 as tf | |
tpu = tf.distribute.cluster_resolver.TPUClusterResolver("node-1") | |
tpu_address = tpu.get_master() | |
tf.disable_v2_behavior() | |
def data_gen(split, shuffle_files=False): | |
ds = tf.data.Dataset.from_tensor_slices(["foobar"]).repeat(100) |
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
# Replace String to int at line 33 | |
:33 s/String/int/ | |
# Replace String to int from line 33 to 40 | |
:33,40 s/String/int/ |
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
# To query which package contains my file if installed | |
dpkg-query -S ASTConsumer.h | |
libclang-6.0-dev: /usr/lib/llvm-6.0/include/clang/AST/ASTConsumer.h | |
# if not installed search here | |
https://packages.ubuntu.com/ | |
# More general case | |
# https://www.ostechnix.com/find-package-provides-specific-file-linux/ | |
# Arch Linux, Antergos, Manjaro Linux |
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
from zmq.eventloop import ioloop | |
ioloop.install() | |
from zmq.eventloop.ioloop import ZMQIOLoop | |
from zmq.eventloop.zmqstream import ZMQStream | |
from functools import partial | |
from jupyter_client import MultiKernelManager | |
from tornado import gen | |
from tornado.concurrent import Future | |
from pprint import pprint |
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
//working gulpfile.js for yeoman | |
//from https://github.com/yeoman/generator-angular/issues/1299 | |
// Generated on 2016-03-15 using generator-angular 0.15.1 | |
'use strict'; | |
var gulp = require('gulp'); | |
var $ = require('gulp-load-plugins')(); | |
var openURL = require('open'); | |
var lazypipe = require('lazypipe'); | |
var rimraf = require('rimraf'); |
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
from zmq.eventloop import ioloop | |
ioloop.install() | |
from zmq.eventloop.ioloop import ZMQIOLoop | |
from zmq.eventloop.zmqstream import ZMQStream | |
from functools import partial | |
from jupyter_client import MultiKernelManager | |
from tornado import gen | |
from tornado.concurrent import Future | |
from pprint import pprint |