Skip to content

Instantly share code, notes, and snippets.

View mkmkme's full-sized avatar
🦀
crab

Mikhail Koviazin mkmkme

🦀
crab
View GitHub Profile
@mkmkme
mkmkme / .envrc
Last active May 7, 2024 12:00
ch-envrc
export CC=/usr/bin/clang-17
export CXX=/usr/bin/clang++-17
export CMAKE_EXPORT_COMPILE_COMMANDS=ON
export CMAKE_GENERATOR=Ninja
export CMAKE_BUILD_PARALLEL_LEVEL=10
export CMAKE_C_COMPILER_LAUNCHER=ccache
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export CMAKE_BUILD_TYPE=RelWithDebInfo
@mkmkme
mkmkme / omg.cpp
Created December 20, 2021 08:46
Modern C++
❯ g++ omg.cpp && ./a.out
S1: Mod
S2: ern C++
@mkmkme
mkmkme / auto.cpp
Created November 26, 2021 11:20
auto return type
#include <optional>
#include <iostream>
auto foo(int x)
{
if (x > 5)
return std::optional<int>{x};
else
return std::nullopt;
@mkmkme
mkmkme / aliases.py
Created July 10, 2019 12:09 — forked from sampsyo/aliases.py
hack for argparse adding subcommand aliases
#!/usr/bin/env python
"""Aliases for argparse positional arguments."""
import argparse
class AliasedSubParsersAction(argparse._SubParsersAction):
class _AliasedPseudoAction(argparse.Action):
def __init__(self, name, aliases, help):
[ecko@work cpp]$ cat autohell.cpp
#include <iostream>
auto add(auto x, auto y)
{
return x + y;
}
struct pt {
float _x, _y;
ecko@victoria in ~
1 λ ll develop/upstream/troglos/romfs/etc/passwd
-rw-rw-r-- 1 ecko ecko 160 Jan 29 15:34 develop/upstream/troglos/romfs/etc/passwd
ecko@victoria in ~
λ rm develop/upstream/troglos/romfs/etc/passwd
rm: cannot remove 'develop/upstream/troglos/romfs/etc/passwd': Permission denied
@mkmkme
mkmkme / -
Created January 16, 2018 16:21
00:00.0 Host bridge [0600]: Intel Corporation 3rd Gen Core processor DRAM Controller [8086:0154] (rev 09)
Subsystem: Lenovo 3rd Gen Core processor DRAM Controller [17aa:21fa]
Control: I/O- Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort+ >SERR- <PERR- INTx-
Latency: 0
Capabilities: [e0] Vendor Specific Information: Len=0c <?>
Kernel driver in use: ivb_uncore
00: 86 80 54 01 06 00 90 20 09 00 00 06 00 00 00 00
10: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 00 00 00 00 aa 17 fa 21
@mkmkme
mkmkme / Makefile
Last active December 25, 2017 16:06
[libdbus-1][c++] NameHasOwner
CXXFLAGS = -Wall -Wextra $(shell pkg-config --cflags --libs dbus-1) -std=c++11
TGT = dbus-has-owner
$(TGT): $(TGT).cpp
$(CXX) $(TGT).cpp $(CXXFLAGS) -o $(TGT)
clean:
rm -f $(TGT)
@mkmkme
mkmkme / zesty_nspawn.sh
Created June 22, 2017 09:18
Create minimal ubuntu zesty install into /var/lib/machines
#!/bin/sh -efux
die() {
printf "%s\n" "$*"
exit 1
}
[ "$#" -ne 1 ] && die "Usage: $(basename ${0}) PATH"
[ $(id -u) -ne 0 ] && die "must be root"
@mkmkme
mkmkme / foo.ipynb
Created May 10, 2017 16:21
foo.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.