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
pub const __builtin_bswap16 = @import("std").zig.c_builtins.__builtin_bswap16; | |
pub const __builtin_bswap32 = @import("std").zig.c_builtins.__builtin_bswap32; | |
pub const __builtin_bswap64 = @import("std").zig.c_builtins.__builtin_bswap64; | |
pub const __builtin_signbit = @import("std").zig.c_builtins.__builtin_signbit; | |
pub const __builtin_signbitf = @import("std").zig.c_builtins.__builtin_signbitf; | |
pub const __builtin_popcount = @import("std").zig.c_builtins.__builtin_popcount; | |
pub const __builtin_ctz = @import("std").zig.c_builtins.__builtin_ctz; | |
pub const __builtin_clz = @import("std").zig.c_builtins.__builtin_clz; | |
pub const __builtin_sqrt = @import("std").zig.c_builtins.__builtin_sqrt; | |
pub const __builtin_sqrtf = @import("std").zig.c_builtins.__builtin_sqrtf; |
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/env julia | |
# Inspired by https://github.com/zenodo/zenodo/issues/1463 | |
module Zenodo | |
# Org/Repo, e.g. "JuliaMath/Interpolations.jl" | |
repo = "" | |
# This is a Zenodo API token that needs to be retrieved from Github webhooks | |
token = "" | |
# Setup environment |
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
<!DOCTYPE html><html lang="en"><head><meta name="viewport" content="width=device-width"><meta charset="utf-8"> | |
<meta name="pluto-insertion-spot-meta"> | |
<meta name="theme-color" media="(prefers-color-scheme: light)" content="white"><meta name="theme-color" media="(prefers-color-scheme: dark)" content="#2a2928"><meta name="color-scheme" content="light dark"><link rel="icon" type="image/png" sizes="16x16" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.19.16/frontend-dist/favicon-16x16.347d2855.png" integrity="sha384-3qsGeVLdddzV9oIkj3PhXXQX2CZCjOD/CiyrPQOX6InOWw3HAHClrsQhPfX9uRAj" crossorigin="anonymous"><link rel="icon" type="image/png" sizes="32x32" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.19.16/frontend-dist/favicon-32x32.8789add4.png" integrity="sha384-cOe5vSoBIgKNgkUL27p9RpsGVY0uBg9PejLccDy+fR8ZD1Iv5dF1MGHjIZAIZwm6" crossorigin="anonymous"><link rel="icon" type="image/png" sizes="96x96" href="https://cdn.jsdelivr.net/gh/fonsp/Pluto.jl@0.19.16/frontend-dist/favicon-96x96.48689391.png" integrity= |
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 h5py | |
import hdf5plugin | |
import numcodecs | |
import numpy as np | |
# Create data | |
A = np.random.randint(1024, size=(1024, 1024, 128)) | |
print("Data as created:") | |
print(A[1, 1, :10]) |
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
# Implementing cell 6 of https://github.com/barbagroup/CFDPython/blob/master/lessons/06_Array_Operations_with_NumPy.ipynb | |
# Inspried during stream of https://www.twitch.tv/brainrpg | |
function main() | |
nx = 81 | |
ny = 81 | |
nt = 100 | |
c = 1 | |
dx = 2 / (nx - 1) | |
dy = 2 / (ny - 1) |
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
module Downsampling | |
using TiledIteration, BenchmarkTools | |
I = rand(UInt16, 10000, 10000); | |
D = zeros(size(I).÷2...); | |
function avgNxN!(I, D, ::Val{N}) where N | |
for c = 1:size(D,2), bc = 1-N:0, r = 1:size(D,1), br = 1-N:0 | |
@inbounds D[r,c] += I[r*N+br, c*N+bc]/N/N | |
end |
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
module WinApi | |
const MAX_PATH = 260 | |
const FILE_ATTRIBUTE_DIRECTORY = 0x10 | |
const INVALID_HANDLE_VALUE = -1 | |
struct FileTime | |
dwLowDateTime::UInt32 | |
dwHighDateTime::UInt32 | |
FileTime() = new(0,0) |
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
# Via Fredrik Ekre | |
# https://julialang.zulipchat.com/#narrow/stream/274208-helpdesk-.28published.29/topic/String.20macro.20for.20rationals.3F | |
function rational_from_string(s) | |
x, y = split(s, '.') | |
a = parse(Int, x) | |
b = parse(Int, y) | |
return a + b // 10^length(y) | |
end | |
macro rational_str(s) |
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
julia> a = 10 | |
10 | |
julia> @info "Macros are awesome" a | |
┌ Info: Macros are awesome | |
└ a = 10 | |
julia> @debug "How awesome?" a | |
julia> using Logging; global_logger( ConsoleLogger(stderr, Logging.Debug) ); |
NewerOlder