Skip to content

Instantly share code, notes, and snippets.

🐧
Programming

Sebastian Karlsson sebbekarlsson

🐧
Programming
Block or report user

Report or block sebbekarlsson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sebbekarlsson
sebbekarlsson / c_vs_cpp.md
Created Aug 1, 2019
C vs CPP, binary size
View c_vs_cpp.md

hello_cpp_cout:

#include <iostream>
int main()
{
    std::cout << "Hello world" << std::endl;
    return 0;
}

Size: 14,924 bytes

@sebbekarlsson
sebbekarlsson / questions.sh
Created Oct 11, 2018
Asking questions in bash
View questions.sh
question_state=0
function ask() {
read -p "$1" -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
question_state=1
fi
}
@sebbekarlsson
sebbekarlsson / cpp_multiple_types.cpp
Last active Sep 18, 2018
C++ function that returns multiple types and multiple types as argument
View cpp_multiple_types.cpp
#include <iostream>
template <typename T>
T perform_operation(const T& left, std::string op, const T& right) {
if (op == "+")
return left + right;
if (op == "-")
return left - right;
}
@sebbekarlsson
sebbekarlsson / python-flask-nginx.md
Last active Jul 13, 2018
Creating a simple web application in Python and running it under Nginx
View python-flask-nginx.md

Python web application with Nginx

Let us create a simple API in Python and serving it using Nginx.

In this example we will use Debian 9 as a distro for the server.

The code

Alright, let's write some code.
We will create an API that will serve an array of fruits.

Let's create a __main__.py file:

You can’t perform that action at this time.