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
#!/usr/bin/env python3 | |
# open tensorflow v1.15 docs via command line | |
# example usage: ./open_tf1docs.py tf.train.ProfilerHook | |
# then it will open: https://www.tensorflow.org/versions/r1.15/api_docs/python/tf/train/ProfilerHook | |
# place it in /usr/local/bin and create symlink if you want shorter alias | |
import sys | |
import webbrowser |
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 torch | |
import torch.nn as nn | |
LEARNING_RATE = 3e-4 | |
# we consider a toy example: minimize the squared value of single vector. | |
x = torch.randn(5) | |
m = nn.MSELoss() # for calculating loss | |
optimizer = torch.optim.Adam([x.requires_grad_()], lr=LEARNING_RATE) |
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
% !TeX program = lualatex | |
\RequirePackage{luatex85} | |
\documentclass{standalone} | |
\usepackage{tikz} | |
\usepackage{luacode} | |
\usepackage{graphicx} | |
\definecolor{joired}{RGB}{218,11,49} | |
\definecolor{joigreen}{RGB}{18,136,104} | |
\definecolor{joiyellow}{RGB}{250,210,49} | |
\definecolor{joiblue}{RGB}{15,105,180} |
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
# copy this to root directory of data and ./resample_delete.sh | |
# ffmpeg required | |
# https://unix.stackexchange.com/questions/103920/parallelize-a-bash-for-loop | |
open_sem(){ | |
mkfifo pipe-$$ | |
exec 3<>pipe-$$ | |
rm pipe-$$ | |
local i=$1 | |
for((;i>0;i--)); do |
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
# pdftoppm joi-style.pdf outputname -png -r 300 -scale-to 1024 | |
import random | |
from PIL import Image | |
img = Image.open('joi-style-1.png') | |
w, h = img.size | |
print(img.size) | |
grid = 16 | |
lw = w // grid |
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
# copy this to root directory of data and | |
# chmod a+x convert.sh | |
# ./convert.sh | |
# https://unix.stackexchange.com/questions/103920/parallelize-a-bash-for-loop | |
open_sem(){ | |
mkfifo pipe-$$ | |
exec 3<>pipe-$$ | |
rm pipe-$$ | |
local i=$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
% All you have to do is replacing `{a/1/2, b/3/4, c/2/1, d/3/2}` and `{a/b, b/c, c/d}`. | |
% With given example, node (a) will be drawn at coordinate (1,2), (b) in at (3,4), ..., | |
% and edges a-b, b-c, c-d will be drawn. | |
% Within `scope` environment, all nodes will be surrounded with circle. | |
\documentclass{standalone} | |
\usepackage{tikz} | |
\usepackage{amsmath, amssymb} | |
\usepackage{pgffor} | |
\begin{document} | |
\begin{tikzpicture} |
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
\documentclass{standalone} | |
\usepackage{tikz} | |
\usepackage{amsmath,amssymb} | |
\usepackage{pgffor} | |
\usepackage{ifthen} | |
\begin{document} | |
\begin{tikzpicture} | |
\node(zero) at (1,0) {$ \phi $}; | |
\foreach \i/\ii in {1/a,2.5/b,4/c,5.5/d}{ | |
\node(\ii) at (\i, 1) {$ \left\{ \ii \right\} $}; |
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 sys | |
sys.setrecursionlimit(100000) | |
def gcd(x, y): | |
return y if x%y == 0 else gcd(y, x%y) | |
def binary_search(s, e, a, b): # a/b | |
# 0: left / 1: right | |
m = s + e | |
if a == 0: |
NewerOlder