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
| alias peers="nmap -sn 192.168.1.0/24|python3 -c $'import sys\n[print(\' \'.j oin(s.split(\' \')[4:]),end=\'\') for s in sys.stdin.readlines()[2::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
| void reverse(char* string, char* buffer, size_t buffer_limit) { | |
| if(buffer_limit < 1) { | |
| return; | |
| } | |
| size_t len = strnlen(string, buffer_limit); | |
| if(len == 0) { | |
| buffer[0] = '\0'; | |
| return; | |
| } | |
| buffer[len] = '\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
| #!/bin/bash | |
| # This is a CodeRunner compile script. Compile scripts are used to compile | |
| # code before being run using the run command specified in CodeRunner | |
| # preferences. This script is invoked with the following properties: | |
| # | |
| # Current directory: The directory of the source file being run | |
| # | |
| # Arguments $1-$n: User-defined compile flags | |
| # | |
| # Environment: $CR_FILENAME Filename of the source file being run |
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
| // | |
| // UIView+Edges.swift | |
| // Centigrade | |
| // | |
| // Created by Paul Herz on 2017-11-02. | |
| // Copyright © 2017 Centigrade. All rights reserved. | |
| // | |
| import UIKit |
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
| alias peers="nmap -sn 192.168.1.0/24|python3 -c $'import sys\n[print(\' \'.join(s.split(\' \')[4:]),end=\'\') for s in sys.stdin.readlines()[2::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
| template<typename T> | |
| class ConcurrentQueue { | |
| protected: | |
| mutable std::mutex queue_mutex; | |
| std::queue<T> queue; | |
| [[nodiscard]] auto getLock() { | |
| return std::lock_guard<std::mutex>(this->queue_mutex); | |
| } | |
| public: |
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
| # This only works for RSA: checks the shared modulus | |
| # of a CSR, Cert, and Private Key | |
| openssl rsa -noout -modulus -in FILE.key | |
| openssl req -noout -modulus -in FILE.csr | |
| openssl x509 -noout -modulus -in FILE.cer |
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
| template< | |
| typename... T, | |
| typename std::enable_if<std::is_same<T&&..., Point>::value>::type | |
| > | |
| Point addPoints(T&&... points) { | |
| // all arguments are guaranteed to be type Point | |
| } |
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
| ''' | |
| Project Euler | |
| Problem 11 | |
| In the 20×20 grid below, four numbers along a diagonal line have been marked in red. | |
| [omitted] | |
| The product of these numbers is 26 × 63 × 78 × 14 = 1788696. | |
| What is the greatest product of four adjacent numbers in the same direction (up, down, left, right, or diagonally) in the 20×20 grid? | |
| ANSWER |
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
| # duration_string(seconds) | |
| # takes a float of seconds and | |
| # returns a formatted unit string | |
| # (microseconds up to years) | |
| # | |
| # with timer(): | |
| # a context that prints the time | |
| # of its inner block | |
| # | |
| # @benchmark() or @benchmark(iterations) |