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
| wget --content-disposition -i urls.txt |
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
| # Find all files KEYWORD | |
| $ fgrep -R --files-with-matches KEYWORD . | |
| # Find all files with FILENAME and KEYWORD | |
| $ find . -name FILENAME -exec fgrep --files-with-matches KEYWORD {} \; |
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
| -- Seach column name in database | |
| select table_name from all_tab_columns where column_name like '%COLUMN_NAME%'; | |
| -- Seach table name in database | |
| select table_name from all_tables where table_name like '%TABLE_NAME%'; |
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
| // Author: Kim Walisch | |
| // Released into public domain | |
| #include <windows.h> | |
| #include <cstdlib> | |
| typedef BOOL (WINAPI *LPFN_GLPI)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, PDWORD); | |
| /// Get the CPU's cache size in bytes. | |
| /// Works on Windows (MSVC, Intel C++ Compiler, Cygwin, ...). |
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
| /// | |
| /// @file constexpr_sqrt.cpp | |
| /// @brief Calculate integer square roots at compile time using | |
| /// C++11 constexpr. | |
| /// @author Kim Walisch, <[email protected]> | |
| /// @license Public Domain | |
| #include <iostream> | |
| #include <cassert> | |
| #include <cmath> |
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
| /// @file segmented_sieve.cpp | |
| /// @author Kim Walisch, <[email protected]> | |
| /// @brief This is a simple implementation of the segmented sieve of | |
| /// Eratosthenes with a few optimizations. It generates the | |
| /// primes below 10^9 in 0.8 seconds (single-threaded) on an | |
| /// Intel Core i7-6700 3.4 GHz CPU. | |
| /// @license Public domain. | |
| #include <iostream> | |
| #include <algorithm> |
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
| /// | |
| /// @file l1d_cache_size.cpp | |
| /// @brief Get the L1 cache size in kilobytes on Windows | |
| /// and most Unix-like operating systems. | |
| /// | |
| /// Copyright (C) 2015 Kim Walisch, <[email protected]> | |
| /// | |
| /// This file is distributed under the BSD License. | |
| /// |
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
| #include <primesieve.hpp> | |
| #include <iostream> | |
| int main() | |
| { | |
| primesieve::iterator it; | |
| uint64_t prime = it.next_prime(); | |
| // iterate over the primes below 10^6 | |
| for (; prime < 1000000; prime = it.next_prime()) |
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
| ; primesieve inner sieving loop | |
| ; Uses only 11 instructions (x86-64) to cross-off the next 8 multiples | |
| .L99: | |
| andb $-3, (%rax) | |
| andb $-9, (%rax,%r14) | |
| andb $127, (%rax,%r12) | |
| andb $-33, (%rax,%rbp) | |
| andb $-2, (%rax,%r10) | |
| andb $-65, (%rax,%rbx) | |
| andb $-5, (%rax,%r9) |
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
| struct libdivide_u64_t libdivide_u64_gen(uint64_t d) { | |
| struct libdivide_u64_t result; | |
| const uint32_t floor_log_2_d = 63 - libdivide__count_leading_zeros64(d); | |
| uint64_t proposed_m, rem; | |
| uint8_t more; | |
| proposed_m = libdivide_128_div_64_to_64(1ULL << floor_log_2_d, 0, d, &rem); //== (1 << (64 + floor_log_2_d)) / d | |
| LIBDIVIDE_ASSERT(rem > 0 && rem < d); |
OlderNewer