Skip to content

Instantly share code, notes, and snippets.

extern crate rayon;
use rayon::prelude::*;
use std::sync::atomic::{AtomicU8, Ordering};
fn main() {
let pos = AtomicU8::new(0);
(2..(u32::MAX as u64)).into_par_iter().for_each(|num| {
let mut inter = num;
while inter >= num {
-- Logs begin at Tue 2020-12-29 21:47:32 WET, end at Mon 2021-03-08 10:42:52 WET. --
mar 08 09:09:46 asimov kernel: Linux version 5.8.0-44-generic (buildd@lgw01-amd64-054) (gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #50~20.04.1-Ubuntu SMP Wed Feb 10 21:07:30 UTC 2021 (Ubuntu 5.8.0-44.50~20.04.1-generic 5.8.18)
mar 08 09:09:46 asimov kernel: Command line: BOOT_IMAGE=/vmlinuz-5.8.0-44-generic root=UUID=c109c6b4-27ff-42a7-8b03-33ced90a63b9 ro quiet splash vt.handoff=7
mar 08 09:09:46 asimov kernel: KERNEL supported cpus:
mar 08 09:09:46 asimov kernel: Intel GenuineIntel
mar 08 09:09:46 asimov kernel: AMD AuthenticAMD
mar 08 09:09:46 asimov kernel: Hygon HygonGenuine
mar 08 09:09:46 asimov kernel: Centaur CentaurHauls
mar 08 09:09:46 asimov kernel: zhaoxin Shanghai
mar 08 09:09:46 asimov kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers'
@pedrocr
pedrocr / comparison.rs
Created January 6, 2021 00:08
Precision of FastInvSquare
fn fast_invsqrt(number: f32, iterations: usize) -> f32 {
let threehalfs: f32 = 1.5;
let x2: f32 = number * 0.5;
let mut i: u32 = number.to_bits();
i = 0x5f3759df - (i >> 1);
let mut y: f32 = f32::from_bits(i);
for _ in 0..iterations {
y = y * ( threehalfs - ( x2 * y * y ) );
}
y
@pedrocr
pedrocr / nef_expanded.rs
Created November 19, 2020 08:01
NEF multiversion expanded
mod nef {
use std::f32::NAN;
use crate::decoders::*;
use crate::decoders::tiff::*;
use crate::decoders::basics::*;
use crate::decoders::ljpeg::huffman::*;
const NIKON_TREE: [[[u8; 16]; 3]; 6] = [
[
[0, 0, 1, 5, 1, 1, 1, 1, 1, 1, 2, 0, 0, 0, 0, 0],
[5, 4, 3, 6, 2, 7, 1, 0, 8, 9, 11, 10, 12, 0, 0, 0],
@pedrocr
pedrocr / arw_expanded.rs
Created November 18, 2020 00:29
Expanded ARW multiversion
mod arw {
use std::f32::NAN;
use std::cmp;
use crate::decoders::*;
use crate::decoders::tiff::*;
use crate::decoders::basics::*;
use multiversion::multiversion;
pub struct ArwDecoder<'a> {
buffer: &'a [u8],
rawloader: &'a RawLoader,
@pedrocr
pedrocr / gist:f3df44af33b9aaa3098ec345598d7bad
Created September 18, 2020 21:17
sway discussion about Ctrl+Shift
12:22 < Guest47651> Hello. Does someone know how to fix this problem? I use Ctrl+Shift combination to switch
keyboard layout, and because of that I can't use combinations with Ctrl+Shift no more, like
Ctrl+Shift+T in Firefox.
12:25 < kennylevinsen> which method did you use to configure the switch to occur?
12:32 < Guest47651> My sway config: https://pastebin.com/zM2afNGx
12:32 -!- arti [~arti@2001:bb8:4008:2020::f] has quit [Ping timeout: 240 seconds]
12:33 < Guest47651> I use method which is described in wiki
12:33 -!- arti [~arti@2001:bb8:4008:2020::f] has joined #sway
12:33 < kennylevinsen> the switch is handled by libxkbcommon, which consumes the events.
12:35 < Guest47651> And?
@pedrocr
pedrocr / gist:d618d47d76e7196882f65b014f6bbbac
Last active August 19, 2020 11:53
sway debug log of output configs not being correctly applied
00:00:00.000 [sway/main.c:326] Sway version v1.5-108b8e97 (Aug 19 2020, branch 'HEAD')
00:00:00.004 [sway/main.c:153] Linux coulson 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
00:00:00.005 [sway/main.c:169] Contents of /etc/lsb-release:
00:00:00.005 [sway/main.c:153] DISTRIB_ID=Ubuntu
00:00:00.005 [sway/main.c:153] DISTRIB_RELEASE=20.04
00:00:00.005 [sway/main.c:153] DISTRIB_CODENAME=focal
00:00:00.005 [sway/main.c:153] DISTRIB_DESCRIPTION="Ubuntu 20.04.1 LTS"
00:00:00.005 [sway/main.c:169] Contents of /etc/os-release:
00:00:00.005 [sway/main.c:153] NAME="Ubuntu"
00:00:00.005 [sway/main.c:153] VERSION="20.04.1 LTS (Focal Fossa)"
$ sudo parted -ls
[sudo] password for pedrocr:
Model: ATA SanDisk SD8SN8U1 (scsi)
Disk /dev/sda: 1024GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 1000MB 999MB primary ext4 boot
@pedrocr
pedrocr / gist:6e2fa4f3526efbb7ee7af2b5cee07b25
Created February 3, 2020 15:47
rawloader cargo-bloat 1.36.0
$ cargo +1.36.0 bloat --release --crates
Finished release [optimized] target(s) in 0.03s
Analyzing target/release/benchmark
File .text Size Crate
11.5% 52.3% 418.1KiB rawloader
4.6% 21.0% 168.1KiB std
3.3% 15.2% 121.6KiB toml
1.0% 4.4% 35.3KiB [Unknown]
0.6% 2.9% 23.2KiB rayon_core
@pedrocr
pedrocr / gist:fc329cec65b29c548d6aba953784c85d
Created February 3, 2020 15:47
rawloader cargo-bloat 1.35.0
$ cargo +1.35.0 bloat --release --crates
Finished release [optimized] target(s) in 0.06s
Analyzing target/release/benchmark
File .text Size Crate
14.8% 52.4% 418.7KiB rawloader
5.9% 20.9% 167.0KiB std
4.3% 15.1% 120.6KiB toml
1.2% 4.4% 35.3KiB [Unknown]
0.8% 3.0% 23.8KiB rayon_core