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
type Foo struct { | |
aaa bool // 1 by default. But with padding - 4. | |
bbb int32 // 4 as max in this struct. | |
ссс bool // 1 by default. But with padding - 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
type Foo struct { | |
aaa bool | |
bbb int32 | |
} | |
fmt.Println(unsafe.Sizeof(x)) // 8 | |
fmt.Println(unsafe.Sizeof(y)) // 8 |
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
package main | |
import ( | |
"fmt" | |
"unsafe" | |
) | |
type Foo struct { | |
} |
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
# touch ~/.vimrc | |
# :w | |
# :source ~/.vimrc ---- or ====> :so % | |
# :PlugInstall | |
call plug#begin('~/.vim/plugged') | |
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } | |
Plug 'morhetz/gruvbox' | |
Plug 'jiangmiao/auto-pairs' |
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
SELECT * FROM generate_series(1,10) ORDER BY 1::integer DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY 1::text DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY (2-1) DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY 1*1 DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY CASE WHEN true THEN 1 ELSE 1 END DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY array_position(ARRAY['one','two'], 'one') DESC; -- 1, 2, 3, ... | |
SELECT * FROM generate_series(1,10) ORDER BY 1 DESC; -- 10, 9, 8, ... |
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
The series of prime numbers: | |
2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199 |
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
############# PHP7 ############# | |
php --version | |
PHP 7.3.11 (cli) (built: Jun 5 2020 23:50:40) ( NTS ) | |
Copyright (c) 1997-2018 The PHP Group | |
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies | |
############# PHP8 ############# |
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 math | |
from time import perf_counter | |
from numba import njit | |
@njit(fastmath=True) | |
def is_prime(num): | |
if num == 2: | |
return True |
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 math | |
from time import perf_counter | |
def is_prime(num): | |
if num == 2: | |
return True | |
if num == 1 or not num % 2: | |
return False | |
for div in range(3, int(math.sqrt(num)) + 1, 2): |
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
python3 --version | |
Python 3.8.5 |