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 -e | |
echo 'Usage: | |
1. install git-filter-repo from https://github.com/newren/git-filter-repo | |
2. make a clean clone of your repository (keep a backup!) | |
3. cd to the repo and run this script | |
' | |
python -c 'input("Are you sure? Press Ctrl-C to cancel or Enter to continue.")' |
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
#= | |
This code comes mostly from the talk "JuliaCon 2019 | Multi-threading in Julia with PARTR": | |
https://youtu.be/HfiRnfKxI64?t=729 | |
It is a Julia translation of this Go code: | |
https://github.com/thomas11/csp/blob/f2ec7c4/csp.go#765 | |
I fixed a few errors in the Julia code: | |
* replaced numPrimes with n | |
* replaced `if m < m` with `if m < mp` |
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
public class Vertex { | |
var key: String | |
public init(key: String) { | |
self.key = key | |
print("Creating vertex \(key)") | |
} | |
deinit { | |
print("Removing vertex \(key)") | |
} | |
} |
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 numpy as np | |
import tensorflow as tf | |
from tensorflow import keras | |
from tensorflow.keras.models import Sequential | |
from tensorflow.keras.layers import Dense, Dropout, Flatten, Conv2D | |
from tensorflow.keras.layers import MaxPooling2D, BatchNormalization | |
keras.backend.clear_session() | |
np.random.seed(1000) | |
tf.random.set_seed(1000) |
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 numpy as np | |
import tensorflow as tf | |
from tensorflow import keras | |
model = keras.models.Sequential([keras.layers.Dense(1, input_shape=[5])]) | |
optimizer = keras.optimizers.SGD() | |
def step(model, optimizer, X_batch, y_batch): | |
with tf.GradientTape() as tape: | |
y_pred = model(X_batch) |
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
""" | |
Converts one or more 3D images for red/blue 3D glasses into stereogram images. Example: | |
Download: | |
https://www.nasa.gov/sites/default/files/styles/full_width/public/thumbnails/image/nh-ut_stereo_bluered_030619.png | |
Then run: | |
python stereogram.py nh-ut_stereo_bluered_030619.png | |
This will generate: |
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 numpy as np | |
from tensorflow import keras | |
import traceback | |
class ResidualBlock(keras.layers.Layer): | |
def __init__(self, n_layers, n_neurons, **kwargs): | |
super().__init__(**kwargs) | |
self.n_layers = n_layers | |
self.n_neurons = n_neurons | |
self.hidden = [keras.layers.Dense(n_neurons, activation="elu", |
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 | |
cat <<EOF > install_cuda_10_and_nvidia_driver_384.sh | |
#!/bin/bash | |
apt-get update && apt-get install -y --no-install-recommends gnupg2 curl ca-certificates && \ | |
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub | apt-key add - && \ | |
echo "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/cuda.list && \ | |
echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64 /" > /etc/apt/sources.list.d/nvidia-ml.list | |
export CUDA_VERSION=10.0.130 |
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
""" | |
Usage: | |
>>> for pid, name in search_procs_by_name("python").items(): | |
... print(pid, name) | |
... | |
11882 python3.6 | |
47599 python3.6 | |
51877 python3.6 | |
51924 python3.6 |
NewerOlder