Archive

Archive for December, 2019

Force Avast NOT to scan my EXEs

December 29, 2019 Leave a comment

Problem
Currently I’m working on a C tutorial and thus I write lots of small C programs. I compile and try all of them to see that everything works fine. Unfortunately I need to do the tutorial under Windows. It wouldn’t be a big issue, but whenever I launch an EXE, Avast starts scanning my EXE because it’s suspicious :( I always lose several seconds with this shit. How to disable this “feature”?

Solution
In Avast you can exclude a directory. So I produce my EXEs in the folder C:\work and I told Avast not to scan this directory. Here is how to do it:

Open Avast, select Protection on the left, then select Virus Scans. On the right side you’ll see a small gear (cog) icon, click on it. On the tab “Full Virus Scan”, go down to the bottom and click on “View exceptions”. Click on the button “Add Exception” and specify the folder that you want to exclude (it was C:\work in my case). Done.

Categories: windows Tags: , , ,

TabNine stopped working with Sublime Text

December 21, 2019 Leave a comment

Problem
TabNine is an awesome plugin that every developer should use. Unfortunately, it stopped working for me a few days ago.

Solution
I found the solution here: https://github.com/zxqfl/TabNine/issues/207 . In short: go to the folder ~/.config/sublime-text-3/Packages/TabNine/binaries/2.1.22, create a folder called x86_64-unknown-linux-musl, and copy the binary from x86_64-unknown-linux-gnu to this newly created folder x86_64-unknown-linux-musl. Finally, restart Sublime Text.

Categories: Uncategorized Tags: , ,

get the ASCII code of a character

December 21, 2019 Leave a comment
man ascii
Categories: bash Tags: , , ,

image viewer for rotating images

December 14, 2019 Leave a comment

Problem
I needed a simple image viewer with which I could rotate some images quickly. And then, of course, save the images after rotation.

Solution
The image viewer Mirage did the job for me. Under Manjaro, I could install it from AUR.

Links
See https://itsfoss.com/image-viewers-linux/ for a list of alternative image viewers.

Categories: linux Tags: , ,

[rust] fast hashmap

December 4, 2019 Leave a comment

Problem
In Rust, the stdlib’s HashMap is quite slow. It’s secure, resistant against DOS attacks, but slow. If I write a tool that I want to use myself, it doesn’t have to be cryptographically secure. I want it to be fast.

Solution
I tried several alternatives and fxhash proved to be the fastest. I compared the stdlib, hashbrown, ahash and fxhash, and fxhash proved to be the fastest.

Usage
In Cargo.toml:

[dependencies]
fxhash = "0.2"

In your code:

use fxhash::FxHashMap as HashMap;    // after these renames, it can be used
use fxhash::FxHashSet as HashSet;    // as a drop-in replacement

fn main() {
    let mut map: HashMap = HashMap::default();    // !!! it's called ::default(), not ::new()
    map.insert(1, "one");
    map.insert(2, "two");

    println!("{:?}", map);                  // {2: "two", 1: "one"}
    println!("{}", map.get(&1).unwrap());   // one
}

Credits
I asked on GitHub how to have a fast hashmap in Rust, and the author of hashbrown directed me to these crates. As Amanieu explained, FxHashMap and AHashMap are aliases of the stdlib’s hashmap with custom hashers.

Categories: rust Tags: , , ,