Skip to content

Instantly share code, notes, and snippets.

View aldanor's full-sized avatar

Ivan Smirnov aldanor

  • Dublin, Ireland
View GitHub Profile
  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
@aldanor
aldanor / mxroute-add-email-subdomain.md
Created February 2, 2024 01:36 — forked from toraritte/mxroute-add-email-subdomain.md
Add email subdomains - MXROUTE email service provider and DirectAdmin control panel

The Setting up SPF and DKIM records of a subdomain thread on StackExchange goes more into the details.

1. Log in to DirectAdmin

In the [MXroute] Important Account Information email there is a section titled "Login Info:", similar to

=====
===== Login Info:
=====
@aldanor
aldanor / test_generic_no_bound.rs
Created October 8, 2022 01:14
arrow2-convert-generics
/// Generics example
use arrow2::array::Array;
use arrow2_convert::{deserialize::TryIntoCollection, serialize::TryIntoArrow};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Foo<A, B>
where
A: Clone,
{
name: String,
@aldanor
aldanor / vlist.h
Last active May 20, 2020 00:44
vlist
#ifndef VLIST_H
#define VLIST_H
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <memory>
#include <utility>
#include <vector>
@aldanor
aldanor / better-yaml.cpp
Last active May 6, 2020 15:08
better-yaml
#define CATCH_CONFIG_MAIN
#include <catch.hpp>
#include <array>
#include <cstdint>
#include <limits>
#include <map>
#include <optional>
#include <sstream>
#include <stdexcept>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@aldanor
aldanor / np-dot-mkl-gemm.md
Last active June 25, 2019 11:39
NumPy dot() vs MKL ?gemm benchmarks

NumPy np.dot() vs MKL dgemm() (+ strict MKL CNR)

  • The tests were run on 4 independent machines with the same specs
  • Each machine has multiple Xeon Platinum 8168 CPUs
  • Python: 3.6, NumPy: 1.16, Intel MKL: 2019.4
  • Either MKL_ENABLE_INSTRUCTIONS or MKL_CBWR was set for each test
  • MKL_DYNAMIC was set to FALSE for all tests
  • MKL_NUM_THREADS was set to either 1, 8 or 16
  • Each test was run for float32 (f4) and float64 (f8) inputs
  • All inputs were pre-aligned to 512-bit boundary (for AVX-512)
@aldanor
aldanor / playground.rs
Created February 20, 2019 13:21 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#[macro_use]
extern crate error_chain; // 0.12.0
extern crate num_traits; // 0.2.6
use num_traits::AsPrimitive;
use std::fmt::Debug;
error_chain! {
types { TractError, TractErrorKind, TractResultExt, TractResult; }
foreign_links {}
@aldanor
aldanor / chunkshape.rs
Last active December 28, 2018 12:51 — forked from rust-play/playground.rs
Code shared from the Rust Playground
pub type Ix = usize;
pub fn estimate_chunkshape(shape: &[Ix], itemsize: usize, base_kb: usize) -> Vec<Ix> {
if shape.is_empty() {
return vec![1];
}
let size: Ix = shape.iter().product();
let size_mb = ((size * itemsize) as f64) / ((1 << 20) as f64);
let basesize = base_kb << 10;
let pow2 = size_mb.max(1.).min((1 << 23) as _).log10().trunc();