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
# Install dependencies | |
sudo apt install tcl-dev tk-dev tcl-tls tcl-snack-dev libtk-img-dev tdom-dev | |
# in scid vs pc source directory | |
./configure BINDIR=$HOME/.local/opt/scidvspc/bin SHAREDIR=$HOME/.local/opt/scidvspc/share CFLAGS='-O3 -march=native' | |
make install |
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
for epoch in range(1): # loop over the dataset multiple times | |
running_loss = 0.0 | |
for i, data in enumerate(train_loader, 0): | |
# get the inputs; data is a list of [inputs, labels] | |
inputs, labels = data | |
# zero the parameter gradients | |
optimizer.zero_grad() | |
# forward | |
outputs = net(inputs) | |
loss = criterion(outputs, labels) |
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
# Author: Hong Xu. This file is under CC0. | |
def pip_install_with_confirmation(packages): | |
"""Run ``pip install`` with a confirmation only if some packages are missing. This is useful to put in the beginning of | |
a Jupyter notebook. | |
Args: | |
packages (dict): Each key is the name of a package to be installed. Each value is a sequence of size 3. The | |
first two elements are the ``package`` and ``name`` parameter of ``importlib.import_module()``, respectively. |
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
watchmedo shell-command \ | |
--patterns='*.pdf' \ | |
--ignore-directories \ | |
--recursive \ | |
--command 'git commit -a -m "U" && git push' |
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/python3 | |
# This file is licensed under CC0 <https://creativecommons.org/publicdomain/zero/1.0/legalcode> | |
# https://www.topbug.net/blog/2016/12/13/send-git-patches-with-gui-email-clients/ | |
import sys | |
import webbrowser | |
try: |
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
$include /etc/inputrc | |
"\C-p":history-search-backward | |
"\C-n":history-search-forward | |
set colored-stats On | |
set completion-ignore-case On | |
set completion-prefix-display-length 3 | |
set mark-symlinked-directories On | |
set show-all-if-ambiguous On | |
set show-all-if-unmodified On |
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
#!/bin/sh | |
# Configure Emacs build options. | |
./autogen.sh | |
mkdir build && cd build | |
# Replace `--with-pgtk` with `--with-cairo` if building for X11. | |
CFLAGS='-march=native -O3' ../configure \ | |
--with-modules \ | |
--with-xwidgets \ |
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
#!/bin/bash | |
# Usage: | |
# grepl [OPTIONS] [GREP-OPTIONS] PATTERN FILE | |
help() { | |
cat <<EOF | |
Usage: grepl [OPTIONS] [GREP-OPTIONS] PATTERN FILE | |
Options: |
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/python3 | |
# | |
# Convert a DIMACS graph to its complement graph. | |
# | |
# Usage: | |
# | |
# to-complement.py < in-dimacs > out-dimacs | |
import sys |
NewerOlder