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
using Random | |
using StaticArrays | |
using LinearAlgebra | |
using DelimitedFiles | |
using ThreadPools | |
using Printf | |
using CellListMap.PeriodicSystems | |
import CellListMap.PeriodicSystems: copy_output, reset_output!, reducer | |
struct Parameters |
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 scipy.fft import fft | |
def clenshaw_curtis(f, a, b, n): | |
# Obtain Chebyshev points | |
x = np.cos(np.pi * np.arange(n + 1) / n) | |
# Rescale the points to the interval | |
scaled_x = ((a + b) + ((b - a) * x)) * 0.5 | |
# Evalute the integrand |
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
function blockjonsson(a::AbstractArray) | |
d = log2(length(a)) | |
x = copy(a) | |
if (d - floor(d)) != 0 | |
@info "Warning: Data size = $(floor(2^d)), is not a power of 2." | |
@info "Truncating data to $(2^floor(d))." | |
x = x[1:(2^round(Int, floor(d)))] | |
end | |
d = round(Int, floor(d)) | |
n = 2^d |
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
function four1!(data, nn, isign) | |
n = Int(2 * nn) | |
j = 1 | |
for i = 1:2:n | |
if j > i | |
tempr = data[j] | |
tempi = data[j + 1] | |
data[j] = data[i] | |
data[j + 1] = data[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
BootStrap: library | |
From: ubuntu:20.04 | |
%post | |
export PATH=/julia-1.5.3/bin:$PATH | |
apt-get -y update | |
# install some basic tools | |
apt-get -y install curl tar gzip git |
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
BootStrap: library | |
From: ubuntu:16.04 | |
%post | |
export PATH=/julia-1.5.3/bin:$PATH | |
export LD_LIBRARY_PATH=/julia-1.5.3/lib:/julia-1.5.3/lib/julia:$LD_LIBRARY_PATH | |
export LC_ALL=C | |
apt-get -y update |
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 | |
import tensorflow.keras as K | |
import numpy as np | |
# Load the MNIST data and show the shape, should be (60000, 28, 28) | |
mnist = K.datasets.mnist | |
(x_train, y_train), (x_test, y_test) = mnist.load_data() | |
print(x_train.shape) |
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 os | |
import sys | |
def some_seed(): | |
seed = int.from_bytes(os.urandom(7), sys.byteorder) | |
return seed |
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
# Configuration for Alacritty, the GPU enhanced terminal emulator. | |
# Any items in the `env` entry below will be added as | |
# environment variables. Some entries may override variables | |
# set by alacritty itself. | |
#env: | |
# TERM variable | |
# | |
# This value is used to set the `$TERM` environment variable for | |
# each instance of Alacritty. If it is not present, alacritty will |
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 hashlib, binascii, os | |
def hash_password(password): | |
"""Hash a password for storing.""" | |
salt = hashlib.sha256(os.urandom(60)).hexdigest().encode("ascii") | |
pwdhash = hashlib.pbkdf2_hmac("sha512", password.encode("utf-8"), | |
salt, 100000) | |
pwdhash = binascii.hexlify(pwdhash) | |
return (salt + pwdhash).decode("ascii") |