View etserver
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 bash | |
# | |
# chkconfig: 35 90 12 | |
# description: EternalTerminal server | |
# | |
# Get function from functions library | |
. /etc/init.d/functions | |
start() { |
View main.py
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
# First: sudo apt install cm-super dvipng texlive-latex-extra texlive-latex-recommended texlive-science | |
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
plt.rcParams["text.usetex"] = False # True # It looks better with the default font. | |
mpl.rcParams["text.latex.preamble"] = (r"\usepackage{siunitx}" | |
r" \sisetup{detect-all}" | |
r" \usepackage{helvet}" | |
r" \usepackage{sansmath}" |
View change_terminal_width.py
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
# See https://youtrack.jetbrains.com/issue/PY-40900#focus=streamItem-27-4082296.0-0 | |
width = 215; print("Terminal width:", width) | |
if sys.stdout.isatty(): | |
import fcntl, struct, sys, termios; fcntl.ioctl(sys.stdin, termios.TIOCSWINSZ, struct.pack("HHHH", 0, width, 0, 0)) | |
else: # In case it's not remote. | |
import os; os.environ["COLUMNS"] = str(width) # It doesn't work everywhere, but it's something. | |
os.environ["LINES"] = "21" # Some programs need both env vars set for any to work. |
View set_terminal_width.py
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 python | |
"""Script to change the terminal width (passed by arg) from Python.""" | |
import argparse | |
import fcntl | |
import struct | |
import sys | |
import termios | |
from array import array | |
from typing import IO |
View find_commits.sh
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 bash | |
for d in ~/repos/*; do | |
pushd "$d" > /dev/null | |
if [ -d .git ]; then | |
echo $d | |
echo "branch $(git rev-parse --abbrev-ref HEAD)" | |
git --no-pager log --color=always --all --oneline --graph --decorate --after 2019-04-20 --before 2019-05-15 --author='Santiago Castro' | |
fi | |
popd > /dev/null |
View bashprofile.py
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 python | |
import argparse | |
import heapq | |
def parse_args(): | |
parser = argparse.ArgumentParser(description="Analyze bashstart log for speed.") | |
parser.add_argument('filename', help="often /tmp/bashstart.<PID>.log") | |
parser.add_argument('-n', default=20, help="number of results to show") | |
return parser.parse_args() |
View conda-python
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 bash | |
set -e | |
if [[ $# -eq 0 ]]; then | |
echo "Illegal number of arguments. Usage: ${0} env_name_or_prefix [args]..." | |
exit 2 | |
fi | |
name=$1 |
View layernorm_vs_fused.py
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 time | |
import torch | |
import torch.nn as nn | |
from apex.normalization import FusedLayerNorm | |
torch.backends.cudnn.benchmark = True |
View snap-refresh-home-nfs.sh
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 bash | |
# This script is a workaround to refresh the snaps under a NFS /home directory with root_squash option (the default). | |
# Note that using no_root_squash is insecure. | |
# The bug was already filed: https://bugs.launchpad.net/snappy/+bug/1804281 | |
set -ex | |
BACKUP_DIR=/s # CREATE AND/OR CHANGE THIS. |
View tensorboard_pb.py
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 | |
# from tensorflow.python.platform import gfile | |
# with tf.Session() as sess: | |
# model_filename ='aaa.pb' | |
# with gfile.FastGFile(model_filename, 'rb') as f: | |
# graph_def = tf.GraphDef() | |
# graph_def.ParseFromString(f.read()) | |
# g_in = tf.import_graph_def(graph_def) | |
# LOGDIR='logsst2' | |
# train_writer = tf.summary.FileWriter(LOGDIR) |
NewerOlder