This file contains hidden or 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
| use std::cmp::Ordering; | |
| impl Solution { | |
| pub fn search(nums: Vec<i32>, target: i32) -> i32 { | |
| let mut left = 0; | |
| let mut right = nums.len() - 1; | |
| while left <= right { | |
| let mut pivot = left + (right - left) >> 1; | |
| match nums[pivot].cmp(&target) { | |
| Ordering::Equal => return pivot as i32, |
This file contains hidden or 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
| Font directories: | |
| /nix/store/pkb8jwi8jxwbjd5v7m7yg3871p1qnism-roboto-2.138 | |
| /nix/store/kpadhaqz7vx83rrdvnwrjndkxq9s5iil-roboto-mono-2.002-20190125 | |
| /nix/store/pw7l75wjxka7zyps8an64i98pddxc1z5-roboto-slab-2.000 | |
| /nix/store/cfgsb3zq7mripqpi3f03dn38s79bbmbm-font-awesome-5.15.3 | |
| /nix/store/41qphrp1ksc1fqm01i7khs30n1zjl56r-fira-code-5.2 | |
| /nix/store/i7fsvlr30nsbgqwwjs146y728mm6xwx4-dejavu-fonts-2.37 | |
| /nix/store/y1hybm8h1kln0hg06c42m4g1wsblc0ig-freefont-ttf-20120503 | |
| /nix/store/dbn507rrsmgmdxwknhb3554nmkl0kvgi-gyre-fonts-2.005 | |
| /nix/store/6pnq37356fml4z6ds00kfav3g7blwsjr-liberation-fonts-2.1.0 |
This file contains hidden or 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
| # UEFI/GPT partitions + LUKS on empty disk. /dev/sdb is my main disk device (/dev/sda is my usb stick) | |
| # Sync time via ntp | |
| timedatectl set-ntp true | |
| # Create gpt partition table | |
| parted -s /dev/sdb mklabel gpt | |
| # /boot 1G | |
| parted -s -a opt /dev/sdb mkpart primary "0%" "1G" |
This file contains hidden or 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 typing as t | |
| from dataclasses import dataclass | |
| class Person(t.Protocol): | |
| name: str | |
| @dataclass | |
| class MyPerson: |
This file contains hidden or 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
| c, r, n = __import__(dir()[1][2:-2]), range(100000), lambda c: c.__name__.lower() | |
| a, o, p, s, i, e = [getattr(c, x) for a, x in zip(r, sorted(dir(c))) if a in [2, 41, 43, 55, 74, 100]] | |
| getattr(e(f'{n(i)}("{n(o)[:2].lower()}")'), n(s)[:6])(f"{n(p).replace(n(p)[1:-3], '')} {'.'.join([str(len(n(o))+1)]*4)}") |
This file contains hidden or 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
| #!/usr/bin/python3 | |
| def print_spaced(string, reversed=False): | |
| char_list = list(string) | |
| if reversed: | |
| char_list.reverse() | |
| print(" ".join(char_list)) | |