View optional.cpp
#include <iostream>
#include <string>
#include <optional>
int main()
{
std::cout << "sizeof bool is " << sizeof(bool) << '\n';
std::cout << "sizeof std::optional<bool> is " << sizeof(std::optional<bool>) << "\n\n";
std::cout << "sizeof short is " << sizeof(short) << '\n';
View README.md

Environment

  • Intel i7-4790 @ 3.60GHz
  • Ubuntu 14.04.5 LTS (Windows Subsystem Linux)
  • GCC 6.2.0
  • Clang 3.9.1
  • CXXFLAGS -std=c++14 -O2

Output

View README.md
tar czfv NEW_NAME.tar.gz OLD_NAME --transform s/OLD_NAME/NEW_NAME/

Note: this only works with GNU Tar.

Example

we want to tar /opt/zlib/1.2.11 into zlib-1.2.11.tar.gz, and we want the top-level folder inside that tar.gz file to be zlib-1.2.11, not 1.2.11:

View shadowsocks-docker-ubuntu.md

Install and run Shadowsocks Docker container in Ubuntu Server 16.04

# Configurations for shadowsocks
export SSPORT=[your shadowsocks port]
export SSPASSWORD=[your shadowsocks password]

# Install docker prerequisites
sudo apt update
sudo apt install apt-transport-https ca-certificates
View git-repo-init.sh
git lfs clone --recursive [repo].git
git submodule foreach git lfs pull
View bashrc.bat
@echo off
set HOME=%HOMEDRIVE%%HOMEPATH%
@rem Utilites
set PATH=%PATH%;C:\Program Files\WinRAR
set PATH=%PATH%;C:\Program Files (x86)\Microsoft VS Code\bin
set PATH=%PATH%;%HOME%\apps\cmake\3.6.0-win64-x64\bin
set PATH=%PATH%;%HOME%\apps\bin
View ec2-ping-test.sh
#!/bin/bash
#
# Usage:
#
# 1. Set SECURITY_GROUP and KEY_NAME to your value
# 2. source ec2-ping-test.sh
# 3. launch_all_instances
# 4. terminate_all_instances
#
View README.md

Copy ssserver.service to under /lib/systemd/system/ and run:

sudo systemctl enable ssserver
sudo systemctl start ssserver
sudo systemctl status ssserver
View README.md
find . -name "*.sh" -exec chmod u+x {} \;
View .bash_aliases
alias netls='sudo netstat -plant | grep LISTEN'
alias netls4='sudo netstat -4 -plant | grep LISTEN'
alias netls6='sudo netstat -6 -plant | grep LISTEN'
alias netlsc='sudo netstat -plant | grep -v LISTEN'
alias netlsc4='sudo netstat -4 -plant | grep -v LISTEN'
alias netlsc6='sudo netstat -6 -plant | grep -v LISTEN'
alias netlsa='sudo netstat -plant'