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
$MARKS_DIR = "$HOME/.powermarks" | |
$MARKS_CWD = ".cwd" | |
New-Item -ItemType Director -Force -Path $MARKS_DIR | |
function _l() { | |
Get-ChildItem -Path $MARKS_DIR | |
} | |
function _m($MARK_LABEL) { | |
Get-Location | Set-Content "$MARKS_DIR/$MARK_LABEL" |
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
// https://github.com/CppCon/CppCon2018/tree/master/Presentations/named_arguements_from_scratch | |
#include <string> | |
#include <boost/hana.hpp> | |
namespace hana = boost::hana; | |
using namespace hana::literals; | |
static int foo(int a, float b, std::string const& c) { | |
return (c.size() + a) / b; |
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 | |
function f() { | |
sleep "$1" | |
echo -n "$1 " | |
} | |
while [ -n "$1" ] | |
do | |
f "$1" & | |
shift | |
done |
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 | |
### CONFIG ### | |
ETH=enp4s0 # interface connected to the Internet | |
WLAN=wlp5s0 # interface serving as an Access Point | |
ACCESS_POINT_SSID=thinkpad | |
ACCESS_POINT_PASS=password | |
SERVER_IP=192.168.42.1 | |
SERVER_SUBNET=192.168.42.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 | |
MOCK=$1 | |
# moves MOCK (ed) to MOCK.real and creates MOCK with logging to MOCK.log and calling MOCK.real | |
REALMOCK=$(realpath ${MOCK}) | |
REAL=${REALMOCK}.real | |
LOG=${REALMOCK}.log |
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 <cassert> | |
template <typename T> | |
using history_t = std::vector<T>; | |
template <typename T> | |
void commit(history_t<T>& h) { assert(h.size()); h.push_back(h.back()); } | |
template <typename T> | |
void undo(history_t<T>& h) { assert(h.size()); h.pop_back(); } |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <limits.h> | |
#include <sys/ptrace.h> | |
#include <sys/wait.h> | |
void dump_memory_region(FILE* pMemFile, unsigned long start_address, long length) | |
{ | |
unsigned long address; | |
int pageLength = 4096; |
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 <type_traits> | |
template <typename T, typename Enable = void> | |
class foo; | |
template <typename T> | |
class foo<T, typename std::enable_if<std::is_integral<T>::value>::type> | |
{ }; | |
template <typename T> |
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 <cstdint> | |
// post: https://notes.underscorediscovery.com/constexpr-fnv1a/ | |
constexpr uint32_t val_32_const = 0x811c9dc5; | |
constexpr uint32_t prime_32_const = 0x1000193; | |
constexpr uint64_t val_64_const = 0xcbf29ce484222325; | |
constexpr uint64_t prime_64_const = 0x100000001b3; | |
inline constexpr uint32_t hash_32_fnv1a_const(const char* const str, const uint32_t value = val_32_const) noexcept { |
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 <algorithm> | |
#include <iostream> | |
#include <iterator> | |
#include <ostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
int main() { | |
vector<string> dst; |
NewerOlder