Skip to content

Instantly share code, notes, and snippets.

@sahandevs
sahandevs / compile-time-safe-builder.rs
Last active July 3, 2022 07:19
Compile-time safe Builder pattern / idea: https://github.com/maminrayej
pub mod ItemBuilder {
pub struct ItemBuilder<const A_SET: bool, const C_SET: bool, const F_SET: bool> {
a: Option<usize>,
b: Option<usize>,
c: Option<usize>,
d: Option<usize>,
e: Option<usize>,
f: Option<usize>,
}
@arsalanses
arsalanses / ngrok-telegram.sh
Created April 9, 2022 21:22
A bash script to start HTop in background, and send Ngrok URL to a Telegram Bot automatically
#!/usr/bin/bash
# install tmux ttyd curl torsocks jq ngrok htop
tmux new -d -s ttyd './ttyd.x86_64 -p 8080 -m 1 -R htop'
tmux split-window -h
tmux send-keys "./ngrok-stable-linux-amd64/ngrok http 8080 -region=ap" C-m
sleep 3
TELEGRAM_TOKEN="" # fill here
TELEGRAM_ID="" # fill here
#!/bin/bash
#a simple script that check mail inbox
#MBOX
#amir mohammadi :)
directory="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
search=""
#------------------------------------
mailboxCheck() {
@steelcowboy
steelcowboy / keybindings.json
Created October 7, 2017 01:03
VS Code -- Caps Lock to Backspace
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "capslock",
"command": "replacePreviousChar",
"args": {
"text": "",
"replaceCharCnt": 1},
"when": "editorTextFocus"
}

THIS DOCUMENT

IS OUT OF

DATE

C++ Coding Standards Part 0: Automated Code Analysis

Automated analysis is the main advantage to working with a modern statically typed compiled language like C++. Code analysis tools can inform us when we have implemented an operator overload with a non-canonical form, when we should have made a method const, or when the scope of a variable can be reduced.