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 / 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();
@aldanor
aldanor / playground.rs
Created October 29, 2018 00:57 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#![allow(dead_code)]
use std::cell::RefCell;
use std::rc::Rc;
trait Stream<'a> {
type Item: 'a + ?Sized;
fn subscribe<F>(self, f: F) where F: FnMut(&Self::Item) + 'a;
@aldanor
aldanor / playground.rs
Created October 26, 2018 01:45 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::cell::RefCell;
use std::rc::Rc;
trait Observer<T> {
fn on_next(&mut self, item: T);
}
impl<T, F> Observer<T> for F where F: FnMut(T) -> () {
fn on_next(&mut self, item: T) {
self(item)
@aldanor
aldanor / playground.rs
Created October 26, 2018 01:16 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::cell::RefCell;
use std::rc::Rc;
trait Observer<T> {
fn on_next(&mut self, item: T);
}
impl<T, F> Observer<T> for F where F: FnMut(T) -> () {
fn on_next(&mut self, item: T) {
self(item)
@aldanor
aldanor / playground.rs
Created October 23, 2018 01:15 — forked from rust-play/playground.rs
Code shared from the Rust Playground
trait Observer<T> {
fn on_next(&mut self, item: Option<T>);
}
impl<T, F> Observer<T> for F where F: FnMut(Option<T>) {
fn on_next(&mut self, item: Option<T>) {
self(item)
}
}