Skip to content

Instantly share code, notes, and snippets.

View Sibirtsev's full-sized avatar
💭
C++

Alexey Sibirtsev Sibirtsev

💭
C++
View GitHub Profile

FWIW: I (@Rondy) am not the author of the content presented here, which is an outline from Edmond Lau's book. I've just copy-pasted it from somewhere and saved as a personal gist, before it got popular on newsnews.ycombinator.com. I don't remember where exactly the original source is from and neither could find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

@Sibirtsev
Sibirtsev / CMakeLists.txt
Last active September 15, 2020 09:23
CMake GTest Example
cmake_minimum_required(VERSION 3.11)
project(GoogleTestDemo)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
add_subdirectory(lib/googletest)
include_directories(lib/googletest/googletest/include)
include_directories(lib/googletest/googlemock/include)
set(SOURCE_FILES main.cpp) # *.cpp
@Sibirtsev
Sibirtsev / speedup.cpp
Created April 10, 2020 18:45
speedup lambda cpp
auto speedup=[](){
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return nullptr;
}();
@Sibirtsev
Sibirtsev / convert_encoding.sh
Created March 7, 2020 11:37
Convert files to utf
#!/bin/sh
find . -type f -print | while read f; do
mv -i "$f" "$f.recode.$$"
iconv -f iso-8859-1 -t utf-8 < "$f.recode.$$" > "$f"
rm -f "$f.recode.$$"
done
@Sibirtsev
Sibirtsev / .bash_profile
Created March 3, 2020 08:47
custom python prompt
export PYTHONSTARTUP="$HOME/ipython.py"
@Sibirtsev
Sibirtsev / colors.sh
Created February 12, 2020 15:11
Bash colors
#!/bin/bash
#Background
for clbg in {40..47} {100..107} 49 ; do
#Foreground
for clfg in {30..37} {90..97} 39 ; do
#Formatting
for attr in 0 1 2 4 5 7 ; do
#Print the result
echo -en "\033[${attr};${clbg};${clfg}m ${attr};${clbg};${clfg}m "
@Sibirtsev
Sibirtsev / perlin.py
Created December 7, 2019 08:13 — forked from eevee/perlin.py
Perlin noise in Python
"""Perlin noise implementation."""
# Licensed under ISC
from itertools import product
import math
import random
def smoothstep(t):
"""Smooth curve with a zero derivative at 0 and 1, making it useful for
interpolating.
@Sibirtsev
Sibirtsev / Instrumentor.h
Created November 17, 2019 13:20 — forked from TheCherno/Instrumentor.h
Basic Instrumentation Profiler
//
// Basic instrumentation profiler by Cherno
// Usage: include this header file somewhere in your code (eg. precompiled header), and then use like:
//
// Instrumentor::Get().BeginSession("Session Name"); // Begin session
// {
// InstrumentationTimer timer("Profiled Scope Name"); // Place code like this in scopes you'd like to include in profiling
// // Code
// }
@Sibirtsev
Sibirtsev / progressbars.py
Created June 26, 2019 10:15 — forked from franccesco/progressbars.py
Testing some of the progressbar libraries that I found interesting
# To test these progress bars you will have to
# install the following packages
# pipenv install click progress progressbar2 tqdm clint
import string
# progress bars
import time
import click
from tqdm import tqdm
@Sibirtsev
Sibirtsev / kbd.css
Created March 8, 2019 12:29
Keyboard style
.kbd {
white-space: nowrap;
color: #000;
background: #eee;
border-color: #ccc #aaa #888 #bbb;
border-style: solid;
/* border-radius: 5px; */
border-width: 1px 3px 3px 1px;
padding: 2px 4px;
}